When using our recognition endpoints the most probable classes are returned concerning dish, drinks, sauces or ingredients (depending on the type).
Ā
With this endpoint, the user has the option to confirm which one of the returned food classes is the correct one.
Ā
By default, the source is set to 'logmeal' and an ID corresponding to an existent dish is expected. The 'source' can also take the value 'other' for specifying a free-text feedback for any dish that is not included in LogMeal's API. Do note that if you confirm a dish with a free-text feedback (source 'other') it won't be taken into consideration when doing any calculation that is based on the dish (e.g. generating ingredients or nutritional information).
Ā
If a food segmentation endpoint has been used then you have to provide a food item identifier for each of the confirmed dishes. This implies adding the extra parameter 'food_item_position'. This parameter consists of a list of elements, one per each confirmed dish, and it must include an integer identifying the segmented region it corresponds to (see 'food_item_position' in returned json for /segmentation endpoints). If you desire to confirm a dish that does not belong to any of the detected regions then a string has to be provided that will act as an unique identifier for that extra confirmed dish.
Ā
Important notes about dish IDs:
- If the image is a default API intake, the dish IDs you can confirm must belong to LogMealās global dataset.
You can check the full list of available dishes in the endpoint
/dataset/dishes. - If the image is a kiosk/tray intake, then the dish IDs must match the dishes actually offered that day and shift in the restaurant.
These valid dish IDs can be retrieved from the endpoint
/kiosk/external/dishes.
Ā
To know if an image is of type kiosk, you can check the endpoints [GET] /intake or /getIntakesList.
If the field is_kiosk_image is true, then you must use the kiosk dish IDs instead of the global dataset.
Ā
Example payload
Suppose an image has already detected dishes with IDs 2284, 2270, and 2290.
If you want to confirm those three and also add a new dish with ID 2267, you need to send all the confirmed IDs and their positions, plus the new one:
{
"imageId": 1982196,
"confirmedClass": [ 2284, 2270, 2299, 2267 ],
"source": [ "logmeal", "logmeal", "logmeal", "logmeal" ],
"food_item_position": [ 1, 2, 3, 4 ]
}
Each list must include both the existing confirmed dishes and any new ones you are adding.
