cozmo_taste_game.image_recognition package¶
cozmo_taste_game.image_recognition.response_analyzer module¶
Class responsible for analyzing the pictures Cozmo takes. At the moment, getFoundFood() will only return a valid value if the same Prop has been seen (streak_threshold) times in a row with a confidence > (threshold)
-
class
cozmo_taste_game.image_recognition.response_analyzer.ResponseAnalyzer(threshold, streak_threshold, isDebugMode)[source]¶ Bases:
object-
analyze_response(file_name)[source]¶ Analyze a photo at location file_name. You feed this function pictures, it analyzes them with the tensorflow model. Once it analyzes the picture, it sees if it has seen the same object more than (streak_threshold) times. If it has, it sets identified_food to what it has found.
Upon entering the function, the has_been_checked flag gets flipped to False.
Parameters: file_name – location of a jpg file Cozmo has taken Returns: None
-
force_input(foodItem)[source]¶ Force the response analyzer to see a food item
Parameters: foodItem – a string of what cozmo should see Returns: None
-
cozmo_taste_game.image_recognition.tensor_functions module¶
This file contains code that runs tensorflow. Most of it should only be changed if the model type is switched, or you know what you are doing.
-
cozmo_taste_game.image_recognition.tensor_functions.allowed_file(filename)[source]¶ Checks to see if the filename supplied is in ALLOWED_EXTENTIONS
Parameters: filename – a file name to be checked Returns: True if the filename is valid, False otherwise
-
cozmo_taste_game.image_recognition.tensor_functions.analyze_photo(filename)[source]¶ Analyzes a photo, and returns a dict containing predictions and confidence
Parameters: filename – the file name of the photo to be analyzed Returns: a dictionary with the form {‘name_of_food_1’ : confidence, …, ‘name_of_food_5 : confidence}