Skip to content

Commit 581f635

Browse files
committed
tflite detect blocks
1 parent 60ca5c3 commit 581f635

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

static/js/blockly/blocks.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,30 @@ Blockly.Python['coderbot_adv_cnn_classify'] = function(block) {
759759
return [class_scores, Blockly.Python.ORDER_ATOMIC];
760760
};
761761

762+
Blockly.Blocks['coderbot_adv_cnn_detect_objects'] = {
763+
/**
764+
* Block for find_class function.
765+
* @this Blockly.Block
766+
*/
767+
init: function() {
768+
this.setHelpUrl(Blockly.Msg.LOGIC_BOOLEAN_HELPURL);
769+
this.setColour(250);
770+
this.appendDummyInput()
771+
.appendField(Blockly.Msg.CODERBOT_SENSOR_FINDOBJECTS)
772+
.appendField(new Blockly.FieldDropdown(CODERBOT_CNN_MODEL_LIST), 'MODEL');
773+
this.setInputsInline(true);
774+
this.setOutput(true, ['Array']);
775+
this.setTooltip(Blockly.Msg.LOGIC_BOOLEAN_TOOLTIP);
776+
}
777+
};
778+
779+
Blockly.Python['coderbot_adv_cnn_detect_objects'] = function(block) {
780+
var model = block.getFieldValue('MODEL');
781+
var class_scores = 'get_cam().cnn_detect_objects("'+ model +'")';
782+
return [class_scores, Blockly.Python.ORDER_ATOMIC];
783+
};
784+
785+
762786
Blockly.Blocks['coderbot_event_generator'] = {
763787
init: function() {
764788
this.appendDummyInput()

static/js/blockly/bot_en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Blockly.Msg.CODERBOT_SENSOR_FINDFACE_SIZE = "size";
5252
Blockly.Msg.CODERBOT_SENSOR_FINDFACE_ALL = "x, y, size (as list)";
5353
Blockly.Msg.CODERBOT_SENSOR_FINDLOGO = "find logo";
5454
Blockly.Msg.CODERBOT_SENSOR_FINDCLASS = "find class";
55+
Blockly.Msg.CODERBOT_SENSOR_FINDOBJECTS = "find objects";
5556
Blockly.Msg.CODERBOT_SENSOR_AVERAGE = "get image average";
5657
Blockly.Msg.CODERBOT_SENSOR_AVERAGE_HUE = "Hue";
5758
Blockly.Msg.CODERBOT_SENSOR_AVERAGE_SATURATION = "Saturation";

static/js/blockly/bot_it.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Blockly.Msg.CODERBOT_SENSOR_FINDFACE_SIZE = "dimensione";
5252
Blockly.Msg.CODERBOT_SENSOR_FINDFACE_ALL = "x, y, dimensione (come lista)";
5353
Blockly.Msg.CODERBOT_SENSOR_FINDLOGO = "trova logo";
5454
Blockly.Msg.CODERBOT_SENSOR_FINDCLASS = "trova classe";
55+
Blockly.Msg.CODERBOT_SENSOR_FINDOBJECTS = "trova oggetti";
5556
Blockly.Msg.CODERBOT_SENSOR_AVERAGE = "valore medio immagine";
5657
Blockly.Msg.CODERBOT_SENSOR_AVERAGE_HUE = "Tinta";
5758
Blockly.Msg.CODERBOT_SENSOR_AVERAGE_SATURATION = "Saturazione";

templates/blocks_adv.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@
303303
<block type="coderbot_adv_findARCode"></block>
304304
<block type="coderbot_adv_find_class"></block>
305305
<block type="coderbot_adv_cnn_classify"></block>
306+
<block type="coderbot_adv_cnn_detect_objects"></block>
306307
<block type="coderbot_sonar_get_distance"></block>
307308
</category>{%endif%}
308309
<category name="{% trans %}Sound{% endtrans %}" colour="220">

0 commit comments

Comments
 (0)