I'm having trouble reading/understanding Clarifai's API query results. Below is my curl query via php. Everything seems to work but the results I get (see example below) don't correspond with the results when testing on their website. On the website model prediction values range from 0.0 to 1.0 (the closer to 1.0 it is the truer it is). Through the API, however, I'm getting values such as 9.800707E-13. What is the range used in the API?
//initiate curl
$ch = curl_init();
//set up curl options
curl_setopt($ch, CURLOPT_URL, 'https://api.clarifai.com/v2/models/my-model/versions/25cd8d254f9542a2a0473d07c2e02ccf/outputs');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{"inputs": [{"data": {"image": {"url": "https://live.staticflickr.com/4017/4273847676_9920e12771_b.jpg"}}}]}");
//set up headers array
$headers = array();
$headers[] = 'Authorization: Key dba0e6dc60414f52af51742cd655cab5';
$headers[] = 'Content-Type: application/json';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
//execute curl, check for error and close
$result = curl_exec($ch);
if (curl_errno($ch)) echo 'Error:' . curl_error($ch);
curl_close($ch);
//decode json to an array
$result = json_decode($result, true);
//to test
echo "<pre>"; print_r($result); echo "</pre>";
Below is the returned concepts testing from the json result:
[data] => Array
(
[concepts] => Array
(
[0] => Array
(
[id] => Plastic-Straw
[name] => Plastic-Straw
[value] => 0.9999347
[app_id] => 8c51e25474ce4d11a2eb4b390c80203a
)
[1] => Array
(
[id] => Straw
[name] => Straw
[value] => 9.800707E-13
[app_id] => 8c51e25474ce4d11a2eb4b390c80203a
)
)
)
Edit: Below is the unformatted JSON output.
{"status":{"code":10000,"description":"Ok","req_id":"e6a9b93a24854921a1b694bedb0d882a"},"outputs":[{"id":"542ad9f40d704cd19e0b964ab1c34737","status":{"code":10000,"description":"Ok"},"created_at":"2021-01-25T19:43:55.966102577Z","model":{"id":"last-straw-model","name":"Last Straw Model","created_at":"2021-01-06T14:24:36.329385Z","app_id":"8c51e25474ce4d11a2eb4b390c80203a","output_info":{"output_config":{"concepts_mutually_exclusive":false,"closed_environment":true,"max_concepts":0,"min_value":0},"message":"Show output_info with: GET /models/{model_id}/output_info","type":"concept","type_ext":"concept"},"model_version":{"id":"25cd8d254f9542a8a0473d07c2e02bbf","created_at":"2021-01-08T13:34:29.630929Z","status":{"code":21100,"description":"Model is trained and ready"},"total_input_count":77,"completed_at":"2021-01-08T13:34:31.506648Z"},"input_info":{},"train_info":{},"model_type_id":"embedding-classifier"},"input":{"id":"f24405b5483d429381f9e6aeb54d7941","data":{"image":{"url":"https://live.staticflickr.com/4017/4273847676_9920e12771_b.jpg"}}},"data":{"concepts":[{"id":"Plastic-Straw","name":"Plastic-Straw","value":0.9999347,"app_id":"8c51e25474ce4d11a2eb4b390c80203a"},{"id":"Straw","name":"Straw","value":9.800707e-13,"app_id":"8c51e25474ce4d11a2eb4b390c80203a"}]}}]}
question from:
https://stackoverflow.com/questions/65890783/reading-understanding-clarifai-query-results