Skip to content

Commit

Permalink
update default cnn classifier in config, small fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
previ committed Dec 26, 2018
1 parent aa3c915 commit bc38f28
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def __init__(self):
if cnn_model != "":
self._cnn_classifiers[cnn_model] = CNNManager.get_instance().load_model(cnn_model)
self._cnn_classifier_default = self._cnn_classifiers[cnn_model]
logging.info("loaded: " + cnn_model + " " + str(self._cnn_classifier_default))

self._camera.grab_start()
self._image_cv = self.get_image()
Expand Down Expand Up @@ -365,11 +366,10 @@ def cnn_classify(self, model_name=None):

img = self.get_image()
classes = classifier.classify_image(img.mat())
s_classes = sorted(classes.items(), key=lambda x: x[1], reverse=True)
return s_classes
return classes

def find_class(self):
return self.cnn_classify()[0][0]
return self.cnn_classify()[0]

def sleep(self, elapse):
logging.debug("sleep: " + str(elapse))
Expand Down
3 changes: 1 addition & 2 deletions cnn_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,5 @@ def classify_image(self,

results = np.squeeze(results)
result = results.argmax()
pairs = {self._labels[result]: results[result]}
logging.info(pairs)
pairs = (self._labels[result], results[result])
return pairs
2 changes: 1 addition & 1 deletion coderbot.cfg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"move_power_angle_3": "60", "cnn_default_model": "fruit_025_128_1", "prog_maxblocks": "-1", "camera_jpeg_quality": "5", "show_page_control": "true", "camera_framerate": "30", "prog_scrollbars": "true", "move_fw_speed": "100", "prog_level": "adv", "move_motor_trim": "1", "move_motor_mode": "dc", "cv_image_factor": "2", "move_power_angle_1": "45", "camera_path_object_size_min": "4000", "button_func": "none", "camera_color_object_size_min": "4000", "camera_jpeg_bitrate": "1000000", "move_fw_elapse": "1", "show_control_move_commands": "true", "camera_color_object_size_max": "160000", "show_page_prefs": "true", "camera_exposure_mode": "auto", "ctrl_tr_elapse": "-1", "show_page_program": "true", "move_tr_elapse": "0.5", "camera_path_object_size_max": "160000", "sound_shutter": "$shutter.mp3", "ctrl_fw_elapse": "-1", "sound_stop": "$shutdown.mp3", "ctrl_tr_speed": "80", "ctrl_fw_speed": "100", "move_tr_speed": "85", "move_power_angle_2": "60", "ctrl_hud_image": "", "load_at_start": "", "sound_start": "$startup.mp3"}
{"move_power_angle_3": "60", "cnn_default_model": "generic_fast_low", "prog_maxblocks": "-1", "camera_jpeg_quality": "5", "show_page_control": "true", "camera_framerate": "30", "prog_scrollbars": "true", "move_fw_speed": "100", "prog_level": "adv", "move_motor_trim": "1", "move_motor_mode": "dc", "cv_image_factor": "2", "move_power_angle_1": "45", "camera_path_object_size_min": "4000", "button_func": "none", "camera_color_object_size_min": "4000", "camera_jpeg_bitrate": "1000000", "move_fw_elapse": "1", "show_control_move_commands": "true", "camera_color_object_size_max": "160000", "show_page_prefs": "true", "camera_exposure_mode": "auto", "ctrl_tr_elapse": "-1", "show_page_program": "true", "move_tr_elapse": "0.5", "camera_path_object_size_max": "160000", "sound_shutter": "$shutter.mp3", "ctrl_fw_elapse": "-1", "sound_stop": "$shutdown.mp3", "ctrl_tr_speed": "80", "ctrl_fw_speed": "100", "move_tr_speed": "85", "move_power_angle_2": "60", "ctrl_hud_image": "", "load_at_start": "", "sound_start": "$startup.mp3"}

0 comments on commit bc38f28

Please sign in to comment.