Skip to content

Commit

Permalink
fix cnn_object detect labels
Browse files Browse the repository at this point in the history
  • Loading branch information
previ committed Aug 2, 2020
1 parent 990d3c7 commit 3e18c47
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 28 deletions.
2 changes: 1 addition & 1 deletion cnn_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def detect_objects(self,
ymax = int(min(imH,(boxes[i][2] * imH)))
xmax = int(min(imW,(boxes[i][3] * imW)))

object_name = self._labels[int(classes[i])]
object_name = self._labels[int(classes[i])+1]
pairs.append((object_name, int(100*scores[i]), (xmin, ymin, xmax, ymax)))

pairs = sorted(pairs, key=lambda x: x[1], reverse=True)[:top_results]
Expand Down
Binary file added cnn_models.tar.xz
Binary file not shown.
44 changes: 19 additions & 25 deletions cnn_models/models.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
{
"base_high_slow": {
"output_layer": "final_result",
"image_width": 224,
"status": 1,
"image_height": 224
},
"base_low_fast": {
"output_layer": "final_result",
"image_width": 224,
"status": 100,
"image_height": 224
},
"object_detect": {
"output_layer": "final_result",
"image_width": 224,
"status": 1,
"image_height": 224
},
"object_detect_mobile": {
"output_layer": "final_result",
"image_width": 224,
"status": 1,
"image_height": 224
}
}
"generic_fast_low": {
"status": 1.0,
"image_height": "224",
"image_width": "224",
"output_layer": ""
},
"generic_slow_high": {
"status": 1.0,
"image_height": "224",
"image_width": "224",
"output_layer": ""
},
"generic_object_detect": {
"status": 1.0,
"image_height": "224",
"image_width": "224",
"output_layer": ""
}
}
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": "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", "encoder": "True"}
{"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", "encoder": "True", "wifi_mode": "ap", "wifi_ssid": "", "wifi_psk": ""}
1 change: 1 addition & 0 deletions data/defaults/programs/program_test_sonars.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name": "test_sonars", "dom_code": "<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"controls_whileUntil\" id=\"0Mx[mSKoV~Gk1qbv5Wrn\" x=\"68\" y=\"148\"><field name=\"MODE\">WHILE</field><value name=\"BOOL\"><block type=\"logic_boolean\" id=\"q8(wB97}Y)d71cgy$yo#\"><field name=\"BOOL\">TRUE</field></block></value><statement name=\"DO\"><block type=\"text_print\" id=\"0fGi]QOF@I*b$5x^?f#A\"><value name=\"TEXT\"><block type=\"text_join\" id=\"HA#?-0mP[+$WL+So^l5J\"><mutation items=\"6\"></mutation><value name=\"ADD0\"><block type=\"text\" id=\"E%5LX*8^Gl-$lv$UIWBv\"><field name=\"TEXT\">Front: </field></block></value><value name=\"ADD1\"><block type=\"coderbot_sonar_get_distance\" id=\"9Mw8Ob~`;a.l/tw}fui`\"><field name=\"SONAR\">0</field></block></value><value name=\"ADD2\"><block type=\"text\" id=\"{xub0XYN;{o:+?BqYjz:\"><field name=\"TEXT\"> Right: </field></block></value><value name=\"ADD3\"><block type=\"coderbot_sonar_get_distance\" id=\"c~T`mQ}cq/AzVk|=_;k#\"><field name=\"SONAR\">1</field></block></value><value name=\"ADD4\"><block type=\"text\" id=\"{oo.?}O~rUC7|]Q9Wu0[\"><field name=\"TEXT\"> Left: </field></block></value><value name=\"ADD5\"><block type=\"coderbot_sonar_get_distance\" id=\"}`5RPkPB/|v%D;^Gc1WM\"><field name=\"SONAR\">2</field></block></value></block></value></block></statement></block></xml>", "code": "while True:\n get_prog_eng().check_end()\n get_cam().set_text(''.join([str(x) for x in ['Front: ', get_bot().get_sonar_distance(0), ' Right: ', get_bot().get_sonar_distance(1), ' Left: ', get_bot().get_sonar_distance(2)]]))\n", "default": false}
2 changes: 1 addition & 1 deletion data/programs.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"_default": {"1": {"name": "test_find_code", "filename": "./data/defaults/programs/program_test_find_code.json", "default": "True"}, "2": {"name": "demo_color_seeker", "filename": "./data/defaults/programs/program_demo_color_seeker.json", "default": "True"}, "3": {"name": "demo_sound_clap_control", "filename": "./data/defaults/programs/program_demo_sound_clap_control.json", "default": "True"}, "4": {"name": "test_find_path_ahead", "filename": "./data/defaults/programs/program_test_find_path_ahead.json", "default": "True"}, "5": {"name": "test_sound_hear", "filename": "./data/defaults/programs/program_test_sound_hear.json", "default": "True"}, "6": {"name": "test_find_color", "filename": "./data/defaults/programs/program_test_find_color.json", "default": "True"}, "7": {"name": "test_cnn_classifier", "filename": "./data/defaults/programs/program_test_cnn_classifier.json", "default": "True"}, "8": {"name": "test_sound_rec", "filename": "./data/defaults/programs/program_test_sound_rec.json", "default": "True"}, "9": {"name": "test_find_face", "filename": "./data/defaults/programs/program_test_find_face.json", "default": "True"}, "10": {"name": "demo_obstacle_avoidance", "filename": "./data/defaults/programs/program_demo_obstacle_avoidance.json", "default": "True"}, "11": {"name": "test_img_average", "filename": "./data/defaults/programs/program_test_img_average.json", "default": "True"}, "12": {"name": "demo_ar_tags", "filename": "./data/defaults/programs/program_demo_ar_tags.json", "default": "True"}, "13": {"name": "test_cnn_object_detect", "filename": "./data/defaults/programs/program_test_cnn_object_detect.json", "default": "True"}, "14": {"name": "demo_line_follower", "filename": "./data/defaults/programs/program_demo_line_follower.json", "default": "True"}}}
{"_default": {"1": {"name": "test_find_code", "filename": "./data/defaults/programs/program_test_find_code.json", "default": "True"}, "2": {"name": "demo_color_seeker", "filename": "./data/defaults/programs/program_demo_color_seeker.json", "default": "True"}, "3": {"name": "demo_sound_clap_control", "filename": "./data/defaults/programs/program_demo_sound_clap_control.json", "default": "True"}, "4": {"name": "test_find_path_ahead", "filename": "./data/defaults/programs/program_test_find_path_ahead.json", "default": "True"}, "5": {"name": "test_sound_hear", "filename": "./data/defaults/programs/program_test_sound_hear.json", "default": "True"}, "6": {"name": "test_find_color", "filename": "./data/defaults/programs/program_test_find_color.json", "default": "True"}, "7": {"name": "test_cnn_classifier", "filename": "./data/defaults/programs/program_test_cnn_classifier.json", "default": "True"}, "8": {"name": "test_sound_rec", "filename": "./data/defaults/programs/program_test_sound_rec.json", "default": "True"}, "9": {"name": "test_find_face", "filename": "./data/defaults/programs/program_test_find_face.json", "default": "True"}, "10": {"name": "demo_obstacle_avoidance", "filename": "./data/defaults/programs/program_demo_obstacle_avoidance.json", "default": "True"}, "11": {"name": "test_sonars", "filename": "./data/defaults/programs/program_test_sonars.json", "default": "True"}, "12": {"name": "test_img_average", "filename": "./data/defaults/programs/program_test_img_average.json", "default": "True"}, "13": {"name": "demo_ar_tags", "filename": "./data/defaults/programs/program_demo_ar_tags.json", "default": "True"}, "14": {"name": "test_cnn_object_detect", "filename": "./data/defaults/programs/program_test_cnn_object_detect.json", "default": "True"}, "15": {"name": "demo_line_follower", "filename": "./data/defaults/programs/program_demo_line_follower.json", "default": "True"}}}

0 comments on commit 3e18c47

Please sign in to comment.