chao hai 11 meses
pai
achega
d0045e000a

+ 278 - 102
blockly/blocks/python/ai.js

@@ -1021,6 +1021,20 @@ Blockly.Python.ai_lcd_showcarvas_set_display = function (block) {
     Blockly.Python.definitions_['v831_import_camera'] = `from maix import camera`;
     Blockly.Python.definitions_['v831_import_camera'] = `from maix import camera`;
     Blockly.Python.addVariable(`_canvas_x`, `_canvas_x = 0`, true)
     Blockly.Python.addVariable(`_canvas_x`, `_canvas_x = 0`, true)
     Blockly.Python.addVariable(`_canvas_y`, `_canvas_y = 0`, true)
     Blockly.Python.addVariable(`_canvas_y`, `_canvas_y = 0`, true)
+    Blockly.Python.definitions_['import_image'] = `image.load_freetype("/root/preset/fonts/simhei.ttf")
+if cameraSize==True:
+    camera.camera.config(size=(320,240))
+else:
+    camera.camera.config(size=(240,320))
+try:
+    if ScreenOrientation==True:
+        canvas = image.new(size = (240, 320))
+    else:
+        canvas = image.new(size = (320, 240))
+except:
+    canvas = image.new(size = (320, 240))
+    pass
+`
     Blockly.Python.definitions_[`v831_display_show_canvas`] = `def v831_display_show_canvas(displayShow):
     Blockly.Python.definitions_[`v831_display_show_canvas`] = `def v831_display_show_canvas(displayShow):
     global _canvas_y,_canvas_x,ScreenOrientation,cameraSize
     global _canvas_y,_canvas_x,ScreenOrientation,cameraSize
     CANVASSHOWIMGAGE = ""
     CANVASSHOWIMGAGE = ""
@@ -2564,10 +2578,14 @@ CAMERATYPE()
     Blockly.Python.definitions_['lcd_invert_init'] = `def lcdRotation(inputImg):
     Blockly.Python.definitions_['lcd_invert_init'] = `def lcdRotation(inputImg):
     global SETVFLIP,SETHMIRROT,cameraSize,ScreenOrientation
     global SETVFLIP,SETHMIRROT,cameraSize,ScreenOrientation
     imageRotationBuffer = inputImg.crop(0, 0, 240, 320)
     imageRotationBuffer = inputImg.crop(0, 0, 240, 320)
-    if ScreenOrientation:
-        imgRotationAim = image.new(size = (240, 320))
-        rotationAngle = 180
-    else:
+    try:
+        if ScreenOrientation:
+            imgRotationAim = image.new(size = (240, 320))
+            rotationAngle = 180
+        else:
+            imgRotationAim = image.new(size = (320, 240))
+            rotationAngle = 90
+    except:
         imgRotationAim = image.new(size = (320, 240))
         imgRotationAim = image.new(size = (320, 240))
         rotationAngle = 90
         rotationAngle = 90
     GETROTATION = imageRotationBuffer.rotate(+rotationAngle, adjust=1)
     GETROTATION = imageRotationBuffer.rotate(+rotationAngle, adjust=1)
@@ -2577,11 +2595,15 @@ CAMERATYPE()
     Blockly.Python.definitions_['lcd_invert_init_new'] = `def lcdRotationNew(inputImg):
     Blockly.Python.definitions_['lcd_invert_init_new'] = `def lcdRotationNew(inputImg):
     global SETVFLIP,SETHMIRROT,cameraSize,ScreenOrientation
     global SETVFLIP,SETHMIRROT,cameraSize,ScreenOrientation
     imageRotationBuffer = inputImg.crop(0, 0, 320, 240)
     imageRotationBuffer = inputImg.crop(0, 0, 320, 240)
-    if ScreenOrientation:
-        imgRotationAim = image.new(size = (240, 320))
-        rotationAngle = 90
-        GETROTATION = imageRotationBuffer.rotate(+rotationAngle, adjust=1)
-    else:
+    try:
+        if ScreenOrientation:
+            imgRotationAim = image.new(size = (240, 320))
+            rotationAngle = 90
+            GETROTATION = imageRotationBuffer.rotate(+rotationAngle, adjust=1)
+        else:
+            imgRotationAim = image.new(size = (320, 240))
+            GETROTATION = imageRotationBuffer
+    except:
         imgRotationAim = image.new(size = (320, 240))
         imgRotationAim = image.new(size = (320, 240))
         GETROTATION = imageRotationBuffer
         GETROTATION = imageRotationBuffer
         
         
@@ -8755,24 +8777,43 @@ Blockly.Blocks['ai_model_digital'] = {
     init: function () {
     init: function () {
         this.appendDummyInput()
         this.appendDummyInput()
             .appendField(Blockly.Msg.ai_model_digital);
             .appendField(Blockly.Msg.ai_model_digital);
+            // this.appendDummyInput()
+            // .appendField(new Blockly.FieldDropdown([
+            //     [Blockly.Msg.ai_models_hand_written_model_number, "digitalResult"],
+            //     [Blockly.Msg.ai_models_hand_written_model_confidence, "digitalConfidence"],
+            //     ["检测框", "digitalCheckout"]
+            // ]), "digital");
         this.setInputsInline(false);
         this.setInputsInline(false);
-        this.setOutput(true, null);
+        this.setPreviousStatement(true, null);
+        this.setNextStatement(true, null);
         this.setColour("#ee783a");
         this.setColour("#ee783a");
-        this.setTooltip(Blockly.Msg.ai_model_digital);
+        this.setTooltip();
         this.setHelpUrl("");
         this.setHelpUrl("");
     }
     }
 };
 };
 
 
 Blockly.Python.ai_model_digital = function (block) {
 Blockly.Python.ai_model_digital = function (block) {
-    var _code = "boxes";
-    return [_code, Blockly.Python.ORDER_ATOMIC];
+    Blockly.Python.addVariable("getDigitalResult", `getDigitalResult = []`)
+    Blockly.Python.addFunction("digitalShowCanvas",`def digitalShowCanvas():
+    global BOXES,getDigitalResult
+    getDigitalResult = []
+    if len(BOXES):
+        for BOXESI, BOXOBJ in enumerate(BOXES):
+            canvas.draw_string(0,0, (str(number_recognition.labels[PROBS[BOXESI][0]]) + str(str(":") + str(round(PROBS[BOXESI][1][PROBS[BOXESI][0]]*100, 2)))), scale = 1, color = (255,0,0) , thickness = 1)
+            canvas.draw_rectangle(BOXOBJ[0],BOXOBJ[1], BOXOBJ[0]+BOXOBJ[2],BOXOBJ[1]+ BOXOBJ[3], color=(255,0,0), thickness=1)
+            getDigitalResult.append({"digitalResult":number_recognition.labels[PROBS[BOXESI][0]],"digitalConfidence":round(PROBS[BOXESI][1][PROBS[BOXESI][0]]*100, 2)})
+`)
+    var _code = "digitalShowCanvas()\n";
+    return _code;
 }
 }
 
 
 Blockly.Blocks['ai_model_digital_attribute'] = {
 Blockly.Blocks['ai_model_digital_attribute'] = {
     init: function () {
     init: function () {
         this.appendDummyInput()
         this.appendDummyInput()
             .appendField(Blockly.Msg.ai_model_digital_attribute);
             .appendField(Blockly.Msg.ai_model_digital_attribute);
-        this.setOutput(true, null);
+        this.setOutput(false, null);
+        this.setNextStatement(true, null);
+        this.setPreviousStatement(true, null);
         this.setColour("#ee783a");
         this.setColour("#ee783a");
         this.setTooltip(Blockly.Msg.ai_model_digital_attribute);
         this.setTooltip(Blockly.Msg.ai_model_digital_attribute);
         this.setHelpUrl("");
         this.setHelpUrl("");
@@ -8782,7 +8823,7 @@ Blockly.Blocks['ai_model_digital_attribute'] = {
 Blockly.Python['ai_model_digital_attribute'] = function (block) {
 Blockly.Python['ai_model_digital_attribute'] = function (block) {
     Blockly.Python.addFunction("",`def ai_model_digital_attribute():`)
     Blockly.Python.addFunction("",`def ai_model_digital_attribute():`)
     var code = 'len(BOXES)';
     var code = 'len(BOXES)';
-    return [code, Blockly.Python.ORDER_NONE];
+    return code;
 };
 };
 
 
 Blockly.Blocks['ai_model_object_init'] = {
 Blockly.Blocks['ai_model_object_init'] = {
@@ -9030,7 +9071,8 @@ Blockly.Blocks['ai_model_look_attribute'] = {
     init: function () {
     init: function () {
         this.appendDummyInput()
         this.appendDummyInput()
             .appendField(Blockly.Msg.ai_model_look_attribute);
             .appendField(Blockly.Msg.ai_model_look_attribute);
-        this.setOutput(true, null);
+        this.setNextStatement(true, null);
+        this.setPreviousStatement(true, null);
         this.setColour("#ee783a");
         this.setColour("#ee783a");
         this.setTooltip(Blockly.Msg.ai_model_look_attribute);
         this.setTooltip(Blockly.Msg.ai_model_look_attribute);
         this.setHelpUrl("");
         this.setHelpUrl("");
@@ -9038,8 +9080,15 @@ Blockly.Blocks['ai_model_look_attribute'] = {
 };
 };
 
 
 Blockly.Python['ai_model_look_attribute'] = function (block) {
 Blockly.Python['ai_model_look_attribute'] = function (block) {
-    var code = 'len(BOXES)';
-    return [code, Blockly.Python.ORDER_NONE];
+    Blockly.Python.addFunction("objectRecognize",`def objectRecognize():
+    global BOXES
+    if len(BOXES):
+        for BOXESI, BOXOBJ in enumerate(BOXES):
+            canvas.draw_string(BOXOBJ[0],(BOXOBJ[1]), ("".join([str(x) for x in [str(labels[PROBS[BOXESI][0]]), ",", round(PROBS[BOXESI][1][PROBS[BOXESI][0]]*100, 2)]])), scale = 1, color = (51,102,255) , thickness = 1)
+            canvas.draw_rectangle(BOXOBJ[0],BOXOBJ[1], BOXOBJ[0]+BOXOBJ[2],BOXOBJ[1]+ BOXOBJ[3], color=(255,0,0), thickness=1)
+`)
+    var code = 'objectRecognize()\n';
+    return code;
 };
 };
 // 猜拳识别
 // 猜拳识别
 Blockly.Blocks['ai_model_Guesswork_init'] = {
 Blockly.Blocks['ai_model_Guesswork_init'] = {
@@ -9081,7 +9130,6 @@ Blockly.Python.ai_model_Guesswork_init = function (block) {
     } else {
     } else {
         a = '["剪刀", "石頭" ,"布"]'
         a = '["剪刀", "石頭" ,"布"]'
     }
     }
-    console.log(language)
     Blockly.Python.definitions_['v831_import_from_maix_nn'] = `from maix import nn`
     Blockly.Python.definitions_['v831_import_from_maix_nn'] = `from maix import nn`
     Blockly.Python.definitions_['v831_import_from_maixnn_decoder'] = `from maix.nn import decoder`
     Blockly.Python.definitions_['v831_import_from_maixnn_decoder'] = `from maix.nn import decoder`
     Blockly.Python.definitions_.import_Guesswork_init = `class Mora:
     Blockly.Python.definitions_.import_Guesswork_init = `class Mora:
@@ -9298,16 +9346,25 @@ Blockly.Blocks['ai_model_Guesswork_look'] = {
         this.appendDummyInput()
         this.appendDummyInput()
             .appendField(Blockly.Msg.ai_models_guesswork_model_if);
             .appendField(Blockly.Msg.ai_models_guesswork_model_if);
         this.setInputsInline(false);
         this.setInputsInline(false);
-        this.setOutput(true, null);
+        this.setNextStatement(true, null);
+        this.setPreviousStatement(true, null);
         this.setColour("#ee783a");
         this.setColour("#ee783a");
         this.setTooltip(Blockly.Msg.ai_models_guesswork_model_if);
         this.setTooltip(Blockly.Msg.ai_models_guesswork_model_if);
         this.setHelpUrl("");
         this.setHelpUrl("");
     }
     }
 };
 };
-
+ 
 Blockly.Python.ai_model_Guesswork_look = function (block) {
 Blockly.Python.ai_model_Guesswork_look = function (block) {
-    var _code = "len(BOXES)";
-    return [_code, Blockly.Python.ORDER_ATOMIC];
+    Blockly.Python.addFunction("guessworkShowRecognize",`def guessworkShowRecognize():
+    global BOXES
+    if len(BOXES):
+        for BOXESI, BOXOBJ in enumerate(BOXES):
+            canvas.draw_string(10,0, (str(str(Mora.labels[PROBS[BOXESI][0]])) + str(str(":") + str(round(PROBS[BOXESI][1][PROBS[BOXESI][0]]*100, 2)))), scale = 1, color = (255,0,0) , thickness = 1)
+            canvas.draw_rectangle(BOXOBJ[0],BOXOBJ[1], BOXOBJ[0]+BOXOBJ[2],BOXOBJ[1]+ BOXOBJ[3], color=(255,0,0), thickness=1)
+
+`)
+    var _code = "guessworkShowRecognize()\n";
+    return _code;
 }
 }
 
 
 
 
@@ -9527,7 +9584,8 @@ Blockly.Blocks['ai_model_face'] = {
         this.appendDummyInput()
         this.appendDummyInput()
             .appendField(Blockly.Msg.ai_models_face_model_if);
             .appendField(Blockly.Msg.ai_models_face_model_if);
         this.setInputsInline(false);
         this.setInputsInline(false);
-        this.setOutput(true, null);
+        this.setNextStatement(true, null);
+        this.setPreviousStatement(true, null);
         this.setColour("#ee783a");
         this.setColour("#ee783a");
         this.setTooltip(Blockly.Msg.ai_models_face_model_if);
         this.setTooltip(Blockly.Msg.ai_models_face_model_if);
         this.setHelpUrl("");
         this.setHelpUrl("");
@@ -9535,8 +9593,14 @@ Blockly.Blocks['ai_model_face'] = {
 };
 };
 
 
 Blockly.Python.ai_model_face = function (block) {
 Blockly.Python.ai_model_face = function (block) {
-    var _code = "len(BOXES)";
-    return [_code, Blockly.Python.ORDER_ATOMIC];
+    Blockly.Python.addFunction("faceShowDetection",`def faceShowDetection():
+    global BOXES
+    if len(BOXES):
+        for BOXESI, BOXOBJ in enumerate(BOXES):
+            canvas.draw_rectangle(BOXOBJ[0],BOXOBJ[1], BOXOBJ[0]+BOXOBJ[2],BOXOBJ[1]+ BOXOBJ[3], color=(255,0,0), thickness=1)
+`)
+    var _code = "faceShowDetection()\n";
+    return _code;
 }
 }
 
 
 
 
@@ -9866,7 +9930,8 @@ Blockly.Blocks['ai_model_card_xy'] = {
         this.appendDummyInput()
         this.appendDummyInput()
             .appendField(Blockly.Msg.ai_models_card_if_true);
             .appendField(Blockly.Msg.ai_models_card_if_true);
         this.setInputsInline(false);
         this.setInputsInline(false);
-        this.setOutput(true, null);
+        this.setNextStatement(true, null);
+        this.setPreviousStatement(true, null);
         this.setColour("#ee783a");
         this.setColour("#ee783a");
         this.setTooltip(Blockly.Msg.ai_models_card_if_true);
         this.setTooltip(Blockly.Msg.ai_models_card_if_true);
         this.setHelpUrl("");
         this.setHelpUrl("");
@@ -9874,8 +9939,15 @@ Blockly.Blocks['ai_model_card_xy'] = {
 };
 };
 
 
 Blockly.Python['ai_model_card_xy'] = function (block) {
 Blockly.Python['ai_model_card_xy'] = function (block) {
-    var code = 'len(CARDDATABOEX)';
-    return [code, Blockly.Python.ORDER_ATOMIC];
+    Blockly.Python.addFunction("cardShowRecognize",`def cardShowRecognize():
+    global CARDDATABOEX
+    if len(CARDDATABOEX):
+        for CARDDATABOEXI in CARDDATABOEX:
+            canvas.draw_rectangle(CARDDATABOEXI[0],CARDDATABOEXI[1], CARDDATABOEXI[0]+CARDDATABOEXI[2]-CARDDATABOEXI[0],CARDDATABOEXI[1]+ CARDDATABOEXI[3]-CARDDATABOEXI[1], color=(255,0,0), thickness=1)
+            canvas.draw_string(CARDDATABOEXI[0],CARDDATABOEXI[1], (str(LPRCARD.get_card_data(CARDDATABOEXI[4][:6]))), scale = 1, color = (255,255,255) , thickness = 1)
+`)
+    var code = 'cardShowRecognize()\n';
+    return code;
 };
 };
 
 
 Blockly.Blocks['ai_model_card_result'] = {
 Blockly.Blocks['ai_model_card_result'] = {
@@ -10180,7 +10252,7 @@ Blockly.Blocks['face_recognition_load'] = {
         this.appendValueInput("class_input")
         this.appendValueInput("class_input")
             .setCheck(null)
             .setCheck(null)
             .appendField(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD + ":")
             .appendField(Blockly.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD + ":")
-            .appendField(new Blockly.FieldVariable("people_name_list"), "people_name");
+            // .appendField(new Blockly.FieldVariable("people_name_list"), "people_name");
         this.setInputsInline(false);
         this.setInputsInline(false);
         this.setPreviousStatement(true, null);
         this.setPreviousStatement(true, null);
         this.setNextStatement(true, null);
         this.setNextStatement(true, null);
@@ -10191,7 +10263,7 @@ Blockly.Blocks['face_recognition_load'] = {
 };
 };
 
 
 Blockly.Python['face_recognition_load'] = function (block) {
 Blockly.Python['face_recognition_load'] = function (block) {
-    var face_list = Blockly.Python.variableDB_.getName(block.getFieldValue('people_name'), Blockly.Variables.NAME_TYPE);
+    // var face_list = Blockly.Python.variableDB_.getName(block.getFieldValue('people_name'), Blockly.Variables.NAME_TYPE);
     var value_class_input = Blockly.Python.valueToCode(block, 'class_input', Blockly.Python.ORDER_ATOMIC);
     var value_class_input = Blockly.Python.valueToCode(block, 'class_input', Blockly.Python.ORDER_ATOMIC);
     Blockly.Python.definitions_['v831_import_from_maix_nn'] = `from maix import nn`
     Blockly.Python.definitions_['v831_import_from_maix_nn'] = `from maix import nn`
     Blockly.Python.definitions_['v831_import_from_maix_nn_face'] = `from maix.nn.app import face`
     Blockly.Python.definitions_['v831_import_from_maix_nn_face'] = `from maix.nn.app import face`
@@ -10288,8 +10360,7 @@ max_face_num = 4
 detect_threshold = 0.5
 detect_threshold = 0.5
 detect_nms = 0.3
 detect_nms = 0.3
 FEATURES = []
 FEATURES = []
-${face_list} = ${value_class_input}
-CLASSNAMEFACELIST = ${face_list}
+CLASSNAMEFACELIST = ${value_class_input}
 `
 `
     var code = `FACESRECOGNITONRESULT = FACERECGNIZER.get_faces(canvas)
     var code = `FACESRECOGNITONRESULT = FACERECGNIZER.get_faces(canvas)
 `;
 `;
@@ -10324,7 +10395,8 @@ Blockly.Blocks['face_recognition_if_face'] = {
         this.appendDummyInput()
         this.appendDummyInput()
             .appendField(Blockly.Msg.ai_models_face_model_if_new);
             .appendField(Blockly.Msg.ai_models_face_model_if_new);
         this.setInputsInline(false);
         this.setInputsInline(false);
-        this.setOutput(true, null);
+        this.setNextStatement(true, null);
+        this.setPreviousStatement(true, null);
         this.setColour("#ee783a");
         this.setColour("#ee783a");
         this.setTooltip(Blockly.Msg.ai_models_face_model_if_new);
         this.setTooltip(Blockly.Msg.ai_models_face_model_if_new);
         this.setHelpUrl("");
         this.setHelpUrl("");
@@ -10332,8 +10404,19 @@ Blockly.Blocks['face_recognition_if_face'] = {
 };
 };
 
 
 Blockly.Python['face_recognition_if_face'] = function (block) {
 Blockly.Python['face_recognition_if_face'] = function (block) {
-    var code = `len(FACESRECOGNITONRESULT)`;
-    return [code, Blockly.Python.ORDER_ATOMIC];
+    Blockly.Python.addFunction("recognizeShowMessage",`def recognizeShowMessage():
+    global FACESRECOGNITONRESULT,isLoadRecoredFace
+    if len(FACESRECOGNITONRESULT):
+        for FACESRECOGNITONRESULTI in FACESRECOGNITONRESULT:
+            if isLoadRecoredFace:
+                canvas.draw_rectangle(FACESRECOGNITONRESULTI[1][0],FACESRECOGNITONRESULTI[1][1], FACESRECOGNITONRESULTI[1][0]+FACESRECOGNITONRESULTI[1][2],FACESRECOGNITONRESULTI[1][1]+ FACESRECOGNITONRESULTI[1][3], color=(51,204,0), thickness=1)
+                canvas.draw_string(40,0, ("".join([str(x) for x in [FACERECGNIZER.recognize(FACESRECOGNITONRESULTI[3])[0], " : ", round(FACERECGNIZER.recognize(FACESRECOGNITONRESULTI[3])[1], 2)]])), scale = 1, color = (51,204,0) , thickness = 1)
+            else:
+                FACERECGNIZER.map_face(FACESRECOGNITONRESULTI[1],FACESRECOGNITONRESULTI[2],canvas)
+                canvas.draw_rectangle(FACESRECOGNITONRESULTI[1][0],FACESRECOGNITONRESULTI[1][1], FACESRECOGNITONRESULTI[1][0]+FACESRECOGNITONRESULTI[1][2],FACESRECOGNITONRESULTI[1][1]+ FACESRECOGNITONRESULTI[1][3], color=(255,0,0), thickness=1)
+`)
+    var code = `recognizeShowMessage()\n`;
+    return code;
 };
 };
 
 
 Blockly.Blocks['face_recognition_face_result'] = {
 Blockly.Blocks['face_recognition_face_result'] = {
@@ -10450,13 +10533,13 @@ Blockly.Python['face_recognition_map_face'] = function (block) {
 Blockly.Blocks['face_recognition_add'] = {
 Blockly.Blocks['face_recognition_add'] = {
     init: function () {
     init: function () {
         this.appendDummyInput()
         this.appendDummyInput()
-            // .appendField(Blockly.Msg.CocoRobo_EVENT_ACTION_OPT1)
-            // .appendField(new Blockly.FieldDropdown([
-            //     ["A", "A"],
-            //     ["B", "B"],
-            //     ["C", "C"],
-            //     ["D", "D"]
-            // ]), "button_type")
+            .appendField(Blockly.Msg.CocoRobo_EVENT_ACTION_OPT1)
+            .appendField(new Blockly.FieldDropdown([
+                ["A", "A"],
+                ["B", "B"],
+                ["C", "C"],
+                ["D", "D"]
+            ]), "button_type")
             .appendField(Blockly.Msg.ai_model_face_gather_1);
             .appendField(Blockly.Msg.ai_model_face_gather_1);
         this.setInputsInline(false);
         this.setInputsInline(false);
         this.setPreviousStatement(true, null);
         this.setPreviousStatement(true, null);
@@ -10468,6 +10551,17 @@ Blockly.Blocks['face_recognition_add'] = {
 };
 };
 
 
 Blockly.Python['face_recognition_add'] = function (block) {
 Blockly.Python['face_recognition_add'] = function (block) {
+    var _type = block.getFieldValue('button_type');
+    Blockly.Python.definitions_['v831_import_sys'] = `import sys
+sys.path.append("/root/")`
+    Blockly.Python.definitions_['v831_import_CocoPi_BUTTON'] = `from CocoPi import BUTTON`
+    // Blockly.Python.definitions_['v831_import_CocoPi'] = `sys.path.append("/root/")`
+    Blockly.Python.definitions_['import_define_x_v831_button'] = `key_A = BUTTON(14)
+key_B = BUTTON(8)
+key_C = BUTTON(13)
+key_D = BUTTON(7)
+`
+    // var code = `key_${_type}.is_pressed()`
     Blockly.Python.definitions_['v831_import_os'] = `import os`
     Blockly.Python.definitions_['v831_import_os'] = `import os`
     Blockly.Python.definitions_['v831_import_json'] = `import json`
     Blockly.Python.definitions_['v831_import_json'] = `import json`
     Blockly.Python.addVariable('ai_model_face_gather', `
     Blockly.Python.addVariable('ai_model_face_gather', `
@@ -10476,31 +10570,46 @@ def _CREATE_TEXT_FILE_WITH_CONTENT(_path, _data, _sep):
     f.write(_data + _sep)
     f.write(_data + _sep)
     f.close()
     f.close()
     `, true);
     `, true);
-    var code = `if NUMBERPERSON < len(CLASSNAMEFACELIST):
-    NUMBERPERSON = NUMBERPERSON + 1
-    FACERECGNIZER.add_user(CLASSNAMEFACELIST[len(FACERECGNIZER)], FACESRECOGNITONRESULTI[3])
-    FEATURES = FACERECGNIZER.features
-    try:
-        os.remove("/root/user/model/recorded_face_features.py")
-    except:
-        pass
-    try:
-        _CREATE_TEXT_FILE_WITH_CONTENT("/root/user/model/recorded_face_features.py", json.dumps(FACERECGNIZER.features), "\\r\\n")
-    except:
-        pass
+    var language = localStorage.getItem("handPyLanguage");
+    let saveFace = ""
+    if(language == "en"){
+        saveFace = "Save Face"
+    }else if(language == "zh-hant"){
+        saveFace = "儲存人臉"
+    }else{
+        saveFace = "保存人脸"
+    }
+    var code = `if key_${_type}.is_pressed():
+    while not (key_${_type}.is_pressed() == False):
+        time.sleep(0.1)
+    if NUMBERPERSON < len(CLASSNAMEFACELIST):
+        NUMBERPERSON = NUMBERPERSON + 1
+        FACERECGNIZER.add_user(CLASSNAMEFACELIST[len(FACERECGNIZER)], FACESRECOGNITONRESULTI[3])
+        FEATURES = FACERECGNIZER.features
+        try:
+            os.remove("/root/user/model/recorded_face_features.py")
+        except:
+            pass
+        try:
+            _CREATE_TEXT_FILE_WITH_CONTENT("/root/user/model/recorded_face_features.py", json.dumps(FACERECGNIZER.features), "\\r\\n")
+        except:
+            pass
+    canvas.draw_string(0,0, str("${saveFace}") + str(NUMBERPERSON), scale = 1, color = (51,204,0) , thickness = 1)
+    v831_display_show_canvas(canvas)
+    time.sleep(1000 / 1000)
 `;
 `;
     return code;
     return code;
 };
 };
 Blockly.Blocks['face_recognition_remove'] = {
 Blockly.Blocks['face_recognition_remove'] = {
     init: function () {
     init: function () {
         this.appendDummyInput()
         this.appendDummyInput()
-            // .appendField(Blockly.Msg.CocoRobo_EVENT_ACTION_OPT1)
-            // .appendField(new Blockly.FieldDropdown([
-            //     ["A", "A"],
-            //     ["B", "B"],
-            //     ["C", "C"],
-            //     ["D", "D"]
-            // ]), "button_type")
+            .appendField(Blockly.Msg.CocoRobo_EVENT_ACTION_OPT1)
+            .appendField(new Blockly.FieldDropdown([
+                ["A", "A"],
+                ["B", "B"],
+                ["C", "C"],
+                ["D", "D"]
+            ]), "button_type")
             .appendField(Blockly.Msg.v831_setting_face_data_remove)
             .appendField(Blockly.Msg.v831_setting_face_data_remove)
         // this.appendStatementInput("input")
         // this.appendStatementInput("input")
         //     .setCheck(null)
         //     .setCheck(null)
@@ -10516,9 +10625,37 @@ Blockly.Blocks['face_recognition_remove'] = {
 };
 };
 
 
 Blockly.Python['face_recognition_remove'] = function (block) {
 Blockly.Python['face_recognition_remove'] = function (block) {
-    //     Blockly.Python.addFunction('statementsInputFaceRemove', `def statementsInputFaceRemove():
-    // ${statements_input}`)
-    var code = `if  NUMBERPERSON > 0:
+    var _type = block.getFieldValue('button_type');
+    Blockly.Python.definitions_['v831_import_sys'] = `import sys
+sys.path.append("/root/")`
+    Blockly.Python.definitions_['v831_import_CocoPi_BUTTON'] = `from CocoPi import BUTTON`
+    // Blockly.Python.definitions_['v831_import_CocoPi'] = `sys.path.append("/root/")`
+    Blockly.Python.definitions_['import_define_x_v831_button'] = `key_A = BUTTON(14)
+key_B = BUTTON(8)
+key_C = BUTTON(13)
+key_D = BUTTON(7)
+`
+    let language = localStorage.getItem("handPyLanguage");
+    let removeFace = ""
+    let faceData = ""
+    if(language == "en"){
+        removeFace = "Remove Face"
+        faceData = "Data"
+    }else if(language == "zh-hant"){
+        removeFace = "刪除人臉"
+        faceData = "數據"
+    }else{
+        removeFace = "删除人脸"
+        faceData = "数据"
+    }
+    var code = `if key_${_type}.is_pressed() and NUMBERPERSON > 0:
+    while not (key_${_type}.is_pressed() == False):
+        time.sleep(0.1)
+    
+    canvas.draw_rectangle(0,0, 0+320,0+ 20, color=(0,0,0), thickness=-1)
+    canvas.draw_string(40,0, ("".join([str(x) for x in ["${removeFace}", NUMBERPERSON, "${faceData}"]])), scale = 1, color = (255,255,255) , thickness = 1)
+    v831_display_show_canvas(canvas)
+    time.sleep(1000 / 1000)
     NUMBERPERSON = NUMBERPERSON - 1
     NUMBERPERSON = NUMBERPERSON - 1
     FACERECGNIZER.remove_user(CLASSNAMEFACELIST[len(FACERECGNIZER)-1])
     FACERECGNIZER.remove_user(CLASSNAMEFACELIST[len(FACERECGNIZER)-1])
     FEATURES = FACERECGNIZER.features
     FEATURES = FACERECGNIZER.features
@@ -10542,11 +10679,13 @@ Blockly.Python['face_recognition_data_load'] = function (block) {
     var value_class_input = Blockly.Python.valueToCode(block, 'class_input', Blockly.Python.ORDER_ATOMIC);
     var value_class_input = Blockly.Python.valueToCode(block, 'class_input', Blockly.Python.ORDER_ATOMIC);
 
 
     Blockly.Python.definitions_['v831_import_json'] = `import json`
     Blockly.Python.definitions_['v831_import_json'] = `import json`
-    Blockly.Python.definitions_['load_face_data'] = `try:
+    Blockly.Python.definitions_['load_face_data'] = `isLoadRecoredFace = False
+try:
     with open("/root/user/model/recorded_face_features.py", "r") as file:
     with open("/root/user/model/recorded_face_features.py", "r") as file:
         FACERECGNIZER.features = json.loads(file.read())
         FACERECGNIZER.features = json.loads(file.read())
+    isLoadRecoredFace = True
 except:
 except:
-    pass
+    isLoadRecoredFace = False
 `
 `
     var code = ``;
     var code = ``;
     return code;
     return code;
@@ -10626,12 +10765,12 @@ Blockly.Blocks['ai_model_self_learning_load'] = {
 Blockly.Python['ai_model_self_learning_load'] = function (block) {
 Blockly.Python['ai_model_self_learning_load'] = function (block) {
     Blockly.Python.definitions_['v831_import_from_maix_nn'] = `from maix import nn`
     Blockly.Python.definitions_['v831_import_from_maix_nn'] = `from maix import nn`
     Blockly.Python.definitions_['v831_import_Classifier'] = `from maix.nn.app.classifier import Classifier`
     Blockly.Python.definitions_['v831_import_Classifier'] = `from maix.nn.app.classifier import Classifier`
+    Blockly.Python.addVariable("SELFLEARNCOUNT",`SELFLEARNCOUNT = 0`,true)
     var value_class_input = Blockly.Python.valueToCode(block, 'class_input', Blockly.Python.ORDER_ATOMIC);
     var value_class_input = Blockly.Python.valueToCode(block, 'class_input', Blockly.Python.ORDER_ATOMIC);
     Blockly.Python.definitions_.import_self_learning_init = `
     Blockly.Python.definitions_.import_self_learning_init = `
 CLASSNUM = ${JSON.parse(value_class_input).length}
 CLASSNUM = ${JSON.parse(value_class_input).length}
 SAMPLENUM = ${JSON.parse(value_class_input).length * 5}
 SAMPLENUM = ${JSON.parse(value_class_input).length * 5}
 CLASSNAMELIST = ${value_class_input}
 CLASSNAMELIST = ${value_class_input}
-
 `
 `
     Blockly.Python.definitions_.self_learing_load = `class Self_learn:
     Blockly.Python.definitions_.self_learing_load = `class Self_learn:
     model = {
     model = {
@@ -10687,6 +10826,7 @@ Blockly.Python['ai_model_self_learning_recognize_load'] = function (block) {
     Blockly.Python.definitions_['v831_from_nn_import_load'] = `from maix.nn.app.classifier import load`
     Blockly.Python.definitions_['v831_from_nn_import_load'] = `from maix.nn.app.classifier import load`
     Blockly.Python.definitions_['v831_import_os'] = `import os`
     Blockly.Python.definitions_['v831_import_os'] = `import os`
     var value_class_input = Blockly.Python.valueToCode(block, 'class_input', Blockly.Python.ORDER_ATOMIC);
     var value_class_input = Blockly.Python.valueToCode(block, 'class_input', Blockly.Python.ORDER_ATOMIC);
+    Blockly.Python.addVariable("SELFLEARNCOUNT",`SELFLEARNCOUNT = 0`,true)
     Blockly.Python.definitions_.import_self_learning_init = `
     Blockly.Python.definitions_.import_self_learning_init = `
 CLASSNUM = ${JSON.parse(value_class_input).length}
 CLASSNUM = ${JSON.parse(value_class_input).length}
 SAMPLENUM = ${JSON.parse(value_class_input).length * 5}
 SAMPLENUM = ${JSON.parse(value_class_input).length * 5}
@@ -10729,22 +10869,41 @@ SELFLEARN = Self_learn()
 Blockly.Blocks['ai_model_self_learning_add_class'] = {
 Blockly.Blocks['ai_model_self_learning_add_class'] = {
     init: function () {
     init: function () {
         this.appendDummyInput()
         this.appendDummyInput()
-            .appendField(Blockly.Msg.ai_model_self_learning_add_class_category + ',');
-        this.appendDummyInput()
-            .appendField(Blockly.Msg.ai_models_init_source)
-            .appendField(new Blockly.FieldVariable("img_self_learning"), "varitem");
+            .appendField(Blockly.Msg.CocoRobo_EVENT_ACTION_OPT1)
+            .appendField(new Blockly.FieldDropdown([
+                ["A", "A"],
+                ["B", "B"],
+                ["C", "C"],
+                ["D", "D"]
+            ]), "button_type")
+            .appendField(Blockly.Msg.ai_model_self_learning_add_class_category+Blockly.Msg.ai_model_self_learning_make_data_set);
         this.setInputsInline(false);
         this.setInputsInline(false);
         this.setPreviousStatement(true, null);
         this.setPreviousStatement(true, null);
         this.setNextStatement(true, null);
         this.setNextStatement(true, null);
         this.setColour("#ee783a");
         this.setColour("#ee783a");
-        this.setTooltip(Blockly.Msg.ai_model_self_learning_add_class_category);
+        this.setTooltip(Blockly.Msg.ai_model_self_learning_add_class_category+Blockly.Msg.ai_model_self_learning_make_data_set);
         this.setHelpUrl("");
         this.setHelpUrl("");
     }
     }
 };
 };
 
 
 Blockly.Python['ai_model_self_learning_add_class'] = function (block) {
 Blockly.Python['ai_model_self_learning_add_class'] = function (block) {
-    var variable_name = Blockly.Python.variableDB_.getName(block.getFieldValue('varitem'), Blockly.Variables.NAME_TYPE);
-    var code = `SELFLEARN.classifier.add_class_img(${variable_name})
+    var _type = block.getFieldValue('button_type');
+    Blockly.Python.definitions_['v831_import_sys'] = `import sys
+sys.path.append("/root/")`
+    Blockly.Python.definitions_['v831_import_CocoPi_BUTTON'] = `from CocoPi import BUTTON`
+    // Blockly.Python.definitions_['v831_import_CocoPi'] = `sys.path.append("/root/")`
+    Blockly.Python.definitions_['import_define_x_v831_button'] = `key_A = BUTTON(14)
+key_B = BUTTON(8)
+key_C = BUTTON(13)
+key_D = BUTTON(7)
+`
+    var code = `if key_${_type}.is_pressed() and SELFLEARNCOUNT < SELFLEARN.class_num:
+    while not (key_${_type}.is_pressed() == False):
+            time.sleep(0.1)
+    SELFLEARN.classifier.add_class_img(canvas)
+    for i in range(5):
+        SELFLEARN.classifier.add_sample_img(canvas)
+    SELFLEARNCOUNT = SELFLEARNCOUNT + 1
 `;
 `;
     return code;
     return code;
 };
 };
@@ -10752,9 +10911,6 @@ Blockly.Blocks['ai_model_self_learning_make_data_set'] = {
     init: function () {
     init: function () {
         this.appendDummyInput()
         this.appendDummyInput()
             .appendField(Blockly.Msg.ai_model_self_learning_make_data_set);
             .appendField(Blockly.Msg.ai_model_self_learning_make_data_set);
-        this.appendDummyInput()
-            .appendField(Blockly.Msg.ai_models_init_source)
-            .appendField(new Blockly.FieldVariable("img_self_learning"), "varitem");
         this.setInputsInline(false);
         this.setInputsInline(false);
         this.setPreviousStatement(true, null);
         this.setPreviousStatement(true, null);
         this.setNextStatement(true, null);
         this.setNextStatement(true, null);
@@ -10765,9 +10921,8 @@ Blockly.Blocks['ai_model_self_learning_make_data_set'] = {
 };
 };
 
 
 Blockly.Python['ai_model_self_learning_make_data_set'] = function (block) {
 Blockly.Python['ai_model_self_learning_make_data_set'] = function (block) {
-    var variable_name = Blockly.Python.variableDB_.getName(block.getFieldValue('varitem'), Blockly.Variables.NAME_TYPE);
     var code = `for i in range(5):
     var code = `for i in range(5):
-    SELFLEARN.classifier.add_sample_img(${variable_name})
+    SELFLEARN.classifier.add_sample_img(canvas)
 `;
 `;
     return code;
     return code;
 };
 };
@@ -10775,19 +10930,39 @@ Blockly.Python['ai_model_self_learning_make_data_set'] = function (block) {
 Blockly.Blocks['ai_model_self_learning_picture'] = {
 Blockly.Blocks['ai_model_self_learning_picture'] = {
     init: function () {
     init: function () {
         this.appendDummyInput()
         this.appendDummyInput()
-            .appendField(Blockly.Msg.ai_model_self_learning_picture);
-
+            .appendField(Blockly.Msg.CocoRobo_EVENT_ACTION_OPT1)
+            .appendField(new Blockly.FieldDropdown([
+                ["A", "A"],
+                ["B", "B"],
+                ["C", "C"],
+                ["D", "D"]
+            ]), "button_type")
+            .appendField(Blockly.Msg.ai_model_self_learning_picture+Blockly.Msg.ai_model_self_learning_save_modal);
         this.setInputsInline(false);
         this.setInputsInline(false);
         this.setPreviousStatement(true, null);
         this.setPreviousStatement(true, null);
         this.setNextStatement(true, null);
         this.setNextStatement(true, null);
         this.setColour("#ee783a");
         this.setColour("#ee783a");
-        this.setTooltip(Blockly.Msg.ai_model_self_learning_picture);
+        this.setTooltip(Blockly.Msg.ai_model_self_learning_picture+Blockly.Msg.ai_model_self_learning_save_modal);
         this.setHelpUrl("");
         this.setHelpUrl("");
     }
     }
 };
 };
 
 
 Blockly.Python['ai_model_self_learning_picture'] = function (block) {
 Blockly.Python['ai_model_self_learning_picture'] = function (block) {
-    var code = `SELFLEARN.classifier.train()
+    var _type = block.getFieldValue('button_type');
+    Blockly.Python.definitions_['v831_import_sys'] = `import sys
+sys.path.append("/root/")`
+    Blockly.Python.definitions_['v831_import_CocoPi_BUTTON'] = `from CocoPi import BUTTON`
+    // Blockly.Python.definitions_['v831_import_CocoPi'] = `sys.path.append("/root/")`
+    Blockly.Python.definitions_['import_define_x_v831_button'] = `key_A = BUTTON(14)
+key_B = BUTTON(8)
+key_C = BUTTON(13)
+key_D = BUTTON(7)
+`
+    var code = `if key_${_type}.is_pressed() and SELFLEARNCOUNT >= SELFLEARN.class_num:
+    while not (key_${_type}.is_pressed() == False):
+        time.sleep(0.1)
+    SELFLEARN.classifier.train()
+    SELFLEARN.classifier.save("/root/module.bin")
 `;
 `;
     return code;
     return code;
 }; Blockly.Blocks['ai_model_self_learning_save_modal'] = {
 }; Blockly.Blocks['ai_model_self_learning_save_modal'] = {
@@ -10814,11 +10989,6 @@ Blockly.Blocks['ai_model_self_learning_class_verification'] = {
     init: function () {
     init: function () {
         this.appendDummyInput()
         this.appendDummyInput()
             .appendField(Blockly.Msg.ai_model_self_learning_class_verification);
             .appendField(Blockly.Msg.ai_model_self_learning_class_verification);
-
-        this.appendDummyInput()
-            .appendField(Blockly.Msg.ai_models_init_source)
-            .appendField(new Blockly.FieldVariable("img_self_learning"), "varitem");
-
         this.setInputsInline(false);
         this.setInputsInline(false);
         this.setPreviousStatement(true, null);
         this.setPreviousStatement(true, null);
         this.setNextStatement(true, null);
         this.setNextStatement(true, null);
@@ -10829,9 +10999,7 @@ Blockly.Blocks['ai_model_self_learning_class_verification'] = {
 };
 };
 
 
 Blockly.Python['ai_model_self_learning_class_verification'] = function (block) {
 Blockly.Python['ai_model_self_learning_class_verification'] = function (block) {
-    var variable_name = Blockly.Python.variableDB_.getName(block.getFieldValue('varitem'), Blockly.Variables.NAME_TYPE);
-
-    var code = `SELFLEARNidx, SELFLEARNdistance = SELFLEARN.classifier.predict(${variable_name})
+    var code = `SELFLEARNidx, SELFLEARNdistance = SELFLEARN.classifier.predict(canvas)
 `;
 `;
     return code;
     return code;
 };
 };
@@ -12182,18 +12350,24 @@ Blockly.Blocks['ai_model_customized_if_got'] = {
     init: function () {
     init: function () {
         this.appendDummyInput()
         this.appendDummyInput()
             .appendField(Blockly.Msg.ai_models_customized_if_got);
             .appendField(Blockly.Msg.ai_models_customized_if_got);
-        this.setOutput(true, null);
+        this.setNextStatement(true, null);
+        this.setPreviousStatement(true, null);
         this.setColour("#ee783a");
         this.setColour("#ee783a");
-        this.setTooltip(Blockly.Msg.ai_model_customized_if_got_TOOLTIP);
+        this.setTooltip(Blockly.Msg.ai_models_customized_if_got);
         this.setHelpUrl("");
         this.setHelpUrl("");
     }
     }
 };
 };
 
 
 Blockly.Python['ai_model_customized_if_got'] = function (block) {
 Blockly.Python['ai_model_customized_if_got'] = function (block) {
-    // TODO: Assemble Python into code variable.
-    var code = 'len(BOXES)';
-    // TODO: Change ORDER_NONE to the correct strength.
-    return [code, Blockly.Python.ORDER_NONE];
+    Blockly.Python.addFunction("faceRecognizeShowResult",`def faceRecognizeShowResult():
+    global BOXES
+    if len(BOXES):
+        for BOXESI, BOXOBJ in enumerate(BOXES):
+            canvas.draw_string((BOXOBJ[0]),(BOXOBJ[1]), ("".join([str(x) for x in [Yolo.labels[PROBS[BOXESI][0]], ";", str(round((PROBS[BOXESI][1][PROBS[BOXESI][0]]*100), 2)) + str("%")]])), scale = 1, color = (255,0,0) , thickness = 1)
+            canvas.draw_rectangle((BOXOBJ[0]),(BOXOBJ[1]), (BOXOBJ[0])+(BOXOBJ[2]),(BOXOBJ[1])+ (BOXOBJ[3]), color=(255,0,0), thickness=1)
+`)
+    var code = 'faceRecognizeShowResult()\n';
+    return code;
 };
 };
 
 
 Blockly.Blocks['ai_model_customized_attribute'] = {
 Blockly.Blocks['ai_model_customized_attribute'] = {
@@ -13308,8 +13482,7 @@ Blockly.Blocks['Numpy_Neural_Network_numpy_loading_model_fun'] = {
         // this.appendDummyInput()
         // this.appendDummyInput()
         //     .appendField("获取检测结果");
         //     .appendField("获取检测结果");
         this.appendDummyInput()
         this.appendDummyInput()
-            .appendField(Blockly.Msg.ai_models_init_source)
-            .appendField(new Blockly.FieldVariable("img_numpyrecognition"), "varitem");
+            .appendField("在屏幕中显示numpy的检测结果")
         this.setPreviousStatement(true, null);
         this.setPreviousStatement(true, null);
         this.setNextStatement(true, null);
         this.setNextStatement(true, null);
         this.setColour("#ee783a");
         this.setColour("#ee783a");
@@ -13319,7 +13492,6 @@ Blockly.Blocks['Numpy_Neural_Network_numpy_loading_model_fun'] = {
 };
 };
 
 
 Blockly.Python['Numpy_Neural_Network_numpy_loading_model_fun'] = function (block) {
 Blockly.Python['Numpy_Neural_Network_numpy_loading_model_fun'] = function (block) {
-    var variable_name = Blockly.Python.variableDB_.getName(block.getFieldValue('varitem'), Blockly.Variables.NAME_TYPE);
     Blockly.Python.definitions_["v831_import_PIL_image"] = `from PIL import Image`
     Blockly.Python.definitions_["v831_import_PIL_image"] = `from PIL import Image`
     Blockly.Python.definitions_["v831_function_numpy_result"] = `def numpyResult(img):
     Blockly.Python.definitions_["v831_function_numpy_result"] = `def numpyResult(img):
     img_path="/root/user/image_1.png"
     img_path="/root/user/image_1.png"
@@ -13343,7 +13515,11 @@ Blockly.Python['Numpy_Neural_Network_numpy_loading_model_fun'] = function (block
     return result   
     return result   
 `
 `
     // TODO: Assemble Python into code variable.
     // TODO: Assemble Python into code variable.
-    var code = `GETNUMPYRESULT = numpyResult(${variable_name})
+    var code = `GETNUMPYRESULT = numpyResult(canvas)
+if GETNUMPYRESULT != "":
+    canvas.draw_string(0,0, (str(GETNUMPYRESULT)), scale = 3, color = (204,204,204) , thickness = 1)
+else:
+    canvas.draw_string(0,0, ("None"), scale = 3, color = (204,204,204) , thickness = 1)
 `;
 `;
     // TODO: Change ORDER_NONE to the correct strength.
     // TODO: Change ORDER_NONE to the correct strength.
     return code;
     return code;

+ 86 - 0
blockly/blocks/python/esp32.js

@@ -3119,6 +3119,92 @@ Blockly.Python['esp32_main_controller_wifi_enable_hotspot_mode'] = function (blo
     return code;
     return code;
 };
 };
 
 
+Blockly.Blocks["V831_code_scanning_network"] = {
+    init:function(){
+        this.appendDummyInput()
+            .appendField(Blockly.Msg.V831_code_scanning_network);
+        this.setInputsInline(false);
+        this.setPreviousStatement(true, null);
+        this.setNextStatement(true, null);
+        this.setColour(ESP32_WIFI_COLOR);
+        this.setTooltip(Blockly.Msg.V831_code_scanning_network);
+        this.setHelpUrl("");
+    }
+}
+Blockly.Python["V831_code_scanning_network"] = function(block){
+    Blockly.Python.definitions_['wifi_is_content'] = `
+def wifi_is_content():
+    global getDateNum
+    cmd = "ping -c 1 123.58.32.151"
+
+    res = os.popen(cmd).read()
+    data = False
+    if res.find("round-trip min/avg/max")>-1:
+        data = True
+    
+    return data
+`
+    Blockly.Python.definitions_['v831_wifi_getdate_noexit'] = `def getNetworkDate_noexit():
+    global getDateNum
+    try:
+        coon = http.client.HTTPConnection("www.baidu.com")
+        coon.request("GET","/")
+        r = coon.getresponse()
+        ts = r.getheader("date")
+        GMT_time = time.strptime(ts[5:25],"%d %b %Y %H:%M:%S")
+        BeiJing_time = time.localtime(time.mktime(GMT_time) + 8*60*60)
+        format_time = time.strftime("%Y-%m-%d %H:%M:%S",BeiJing_time)
+        command = "date -s "+"\\"{}\\"".format(format_time)
+        os.system(command)
+        getDateNum = 1
+        # sys.exit()
+    except:
+        pass
+`
+    let language = localStorage.getItem('language')
+    let str = ""
+    if(language == "zh-hant"){
+        str = "請掃描平臺Wi-Fi二維碼聯網"
+    }else if(language =="en"){
+        str = "Please scan the platform Wi-Fi QR code for networking"
+    }else{
+        str = "请扫描平台Wi-Fi二维码联网"
+    }
+    Blockly.Python.addFunction("codeScanningNetwork",`def codeScanningNetwork():
+    if wifi_is_content():
+        stateNetwork = 1
+    else:
+        stateNetwork = 0
+        CODERESULT = ""
+        while True:
+            if stateNetwork == 0:
+                canvas = getLcdRotation(camera.capture())
+                qrCode = canvas.find_qrcodes()
+                canvas.draw_rectangle(0,0, 0+320,0+ 20, color=(0,0,0), thickness=-1)
+                canvas.draw_string(50,0, "${str}", scale = 1, color = (255,255,255) , thickness = 1)
+                for i in qrCode:
+                    canvas.draw_string((i["x"]),(i["y"]), (i["payload"]), scale = 1, color = (255,0,0) , thickness = 1)
+                    canvas.draw_rectangle((i["x"]),(i["y"]), (i["x"])+(i["w"]),(i["y"])+ (i["h"]), color=(255,0,0), thickness=1)
+                    CODERESULT = (i["payload"]).split(";")
+                v831_display_show_canvas(canvas)
+                if CODERESULT != "":
+                    WiFiSSID = CODERESULT[0][5 : ]
+                    WiFiPSD = CODERESULT[1][5 : ]
+                    os.system("wifi_disconnect_ap_test")
+                    os.system("wifi_connect_chinese_ap_test "+WiFiSSID+" "+WiFiPSD+"")
+                    getNetworkDate_noexit()
+                    if wifi_is_content():
+                        state = 1
+                    else:
+                        state = 0
+                    CODERESULT = ""
+            elif stateNetwork == 1:
+                break
+`
+)
+    var code = "codeScanningNetwork()\n"
+    return code;
+}
 
 
 Blockly.Blocks['esp32_main_controller_wifi_connect_internet'] = {
 Blockly.Blocks['esp32_main_controller_wifi_connect_internet'] = {
     init: function () {
     init: function () {

+ 8 - 7
blockly/msg/js/en.js

@@ -3737,6 +3737,7 @@ Blockly.Msg.wifi_setup_hotspot = "Create Wi-Fi Hotspot";
 Blockly.Msg.wifi_hotspot_ssid = "SSID:";
 Blockly.Msg.wifi_hotspot_ssid = "SSID:";
 Blockly.Msg.wifi_hotspot_pass = "Password:";
 Blockly.Msg.wifi_hotspot_pass = "Password:";
 Blockly.Msg.wifi_connect_router = "Connect to Wi-Fi Network";
 Blockly.Msg.wifi_connect_router = "Connect to Wi-Fi Network";
+Blockly.Msg.V831_code_scanning_network = "code-sweeping networking"
 Blockly.Msg.wifi_router_ssid = "SSID:";
 Blockly.Msg.wifi_router_ssid = "SSID:";
 Blockly.Msg.wifi_router_pass = "Password:";
 Blockly.Msg.wifi_router_pass = "Password:";
 Blockly.Msg.wifi_router_disconnect = "Disconnect Wi-Fi Connection";
 Blockly.Msg.wifi_router_disconnect = "Disconnect Wi-Fi Connection";
@@ -4719,7 +4720,7 @@ Blockly.Msg.ai_models_load_title = "Load Preset A.I. Model:";
 Blockly.Msg.ai_models_init_hand_written_model = "Starting handwritten number recognition";
 Blockly.Msg.ai_models_init_hand_written_model = "Starting handwritten number recognition";
 Blockly.Msg.ai_models_init_object_model = "Object Detection Model";
 Blockly.Msg.ai_models_init_object_model = "Object Detection Model";
 Blockly.Msg.ai_models_init_guesswork_model = "Guesswork recognition model";
 Blockly.Msg.ai_models_init_guesswork_model = "Guesswork recognition model";
-Blockly.Msg.ai_models_guesswork_model_if = "Test with guessing results";
+Blockly.Msg.ai_models_guesswork_model_if = "Displays the recognized guessing results in the screen";
 Blockly.Msg.ai_models_guesswork_model_get = "Obtain the results of the detected fist guessing";
 Blockly.Msg.ai_models_guesswork_model_get = "Obtain the results of the detected fist guessing";
 Blockly.Msg.ai_model_guesswork_look_attribute = "For every guess detected";
 Blockly.Msg.ai_model_guesswork_look_attribute = "For every guess detected";
 Blockly.Msg.ai_models_init_object_model_title = "Object Detection Model(aeroplane,bicycle,bird,boat,bottle,bus,car,cat,chair,cow,diningtable,dog,horse,motorbike,person,pottedplant,sheep,sofa,train,tvmonitor)";
 Blockly.Msg.ai_models_init_object_model_title = "Object Detection Model(aeroplane,bicycle,bird,boat,bottle,bus,car,cat,chair,cow,diningtable,dog,horse,motorbike,person,pottedplant,sheep,sofa,train,tvmonitor)";
@@ -4730,11 +4731,11 @@ Blockly.Msg.ai_models_init_source_written = "Recognize Hand-written from:";
 Blockly.Msg.ai_models_hand_written_model_result = "Get the Hand-written Digit recognition result";
 Blockly.Msg.ai_models_hand_written_model_result = "Get the Hand-written Digit recognition result";
 Blockly.Msg.ai_models_hand_written_model_number = "Get the number recognized (from 0 to 9)";
 Blockly.Msg.ai_models_hand_written_model_number = "Get the number recognized (from 0 to 9)";
 Blockly.Msg.ai_models_hand_written_model_confidence = "Get the confidence rate of the number recognized (%)";
 Blockly.Msg.ai_models_hand_written_model_confidence = "Get the confidence rate of the number recognized (%)";
-Blockly.Msg.ai_model_digital = "Tested Digital attribute";
+Blockly.Msg.ai_model_digital = "Display the result of recognizing the handwritten digits in the screen";
 Blockly.Msg.ai_model_digital_attribute = "Digits detected";
 Blockly.Msg.ai_model_digital_attribute = "Digits detected";
 Blockly.Msg.ai_models_object_model_if = "Recognized Any tested Object";
 Blockly.Msg.ai_models_object_model_if = "Recognized Any tested Object";
 Blockly.Msg.ai_models_object_model_get = "Get the recognized tested Object's";
 Blockly.Msg.ai_models_object_model_get = "Get the recognized tested Object's";
-Blockly.Msg.ai_model_look_attribute = "Object detected";
+Blockly.Msg.ai_model_look_attribute = "Display the result of recognizing the object in the screen";
 Blockly.Msg.ai_models_object_model_name = "Name";
 Blockly.Msg.ai_models_object_model_name = "Name";
 Blockly.Msg.ai_models_object_model_x = "X-axis coordinates of the starting point of the detection box";
 Blockly.Msg.ai_models_object_model_x = "X-axis coordinates of the starting point of the detection box";
 Blockly.Msg.ai_models_object_model_y = "Y axis coordinates of the starting point of the detection box";
 Blockly.Msg.ai_models_object_model_y = "Y axis coordinates of the starting point of the detection box";
@@ -4743,9 +4744,9 @@ Blockly.Msg.ai_models_object_model_h = "Y-axis coordinates of terminal point of
 Blockly.Msg.ai_models_object_model_count = "Total Number";
 Blockly.Msg.ai_models_object_model_count = "Total Number";
 Blockly.Msg.ai_models_object_model_index = "Index";
 Blockly.Msg.ai_models_object_model_index = "Index";
 Blockly.Msg.ai_models_object_model_confidence = "Confidence Rate";
 Blockly.Msg.ai_models_object_model_confidence = "Confidence Rate";
-Blockly.Msg.ai_models_face_model_if_new = "Face recognized";
+Blockly.Msg.ai_models_face_model_if_new = "Display the recognized face information on the screen.";
 Blockly.Msg.ai_model_face_attribute_new = "For every face we recognize";
 Blockly.Msg.ai_model_face_attribute_new = "For every face we recognize";
-Blockly.Msg.ai_models_face_model_if = "Recognized Any Human Face";
+Blockly.Msg.ai_models_face_model_if = "Display the detected face results in the screen";
 Blockly.Msg.ai_model_face_attribute = "Face attribute";
 Blockly.Msg.ai_model_face_attribute = "Face attribute";
 Blockly.Msg.ai_models_face_model_get = "Get the recognized Humand Face";
 Blockly.Msg.ai_models_face_model_get = "Get the recognized Humand Face";
 Blockly.Msg.ai_models_face_model_x = "X-axis coordinates of the starting point of the detection box";
 Blockly.Msg.ai_models_face_model_x = "X-axis coordinates of the starting point of the detection box";
@@ -4773,7 +4774,7 @@ Blockly.Msg.v831_transmission_setup_show = "The captured camera image is transfe
 Blockly.Msg.v831_internet_transmission_setup_show = "Display the captured camera images on the web";
 Blockly.Msg.v831_internet_transmission_setup_show = "Display the captured camera images on the web";
 Blockly.Msg.ai_models_init_card_model = "License plate recognition model";
 Blockly.Msg.ai_models_init_card_model = "License plate recognition model";
 Blockly.Msg.ai_models_init_card_result = "License plate result";
 Blockly.Msg.ai_models_init_card_result = "License plate result";
-Blockly.Msg.ai_models_card_if_true = "License plate detected";
+Blockly.Msg.ai_models_card_if_true = "Display the result of the detected license plate in the screen";
 Blockly.Msg.ai_models_card_attribute = "For each license plate detected";
 Blockly.Msg.ai_models_card_attribute = "For each license plate detected";
 Blockly.Msg.ai_models_card_model_get = "Get the detection of the license plate";
 Blockly.Msg.ai_models_card_model_get = "Get the detection of the license plate";
 
 
@@ -4782,7 +4783,7 @@ Blockly.Msg.ai_models_customized_init_type_set_fast = "Single Face (Fast)";
 Blockly.Msg.ai_models_customized_init_type_set_slow = "Multiple Faces (Slow)";
 Blockly.Msg.ai_models_customized_init_type_set_slow = "Multiple Faces (Slow)";
 
 
 Blockly.Msg.ai_models_customized_init_setup_name = "Define class name by list:";
 Blockly.Msg.ai_models_customized_init_setup_name = "Define class name by list:";
-Blockly.Msg.ai_models_customized_if_got = "Recognized any object from customized model";
+Blockly.Msg.ai_models_customized_if_got = "Displaying customized recognition results on the screen";
 Blockly.Msg.ai_model_customized_attribute = "For each custom model object recognized";
 Blockly.Msg.ai_model_customized_attribute = "For each custom model object recognized";
 Blockly.Msg.ai_models_customized_get_result_any = "Get the recognized Object's";
 Blockly.Msg.ai_models_customized_get_result_any = "Get the recognized Object's";
 Blockly.Msg.ai_models_customized_get_result_name = "Name";
 Blockly.Msg.ai_models_customized_get_result_name = "Name";

+ 8 - 7
blockly/msg/js/zh-hans.js

@@ -3729,6 +3729,7 @@ Blockly.Msg.wifi_setup_hotspot = "创建 Wi-Fi 热点";
 Blockly.Msg.wifi_hotspot_ssid = "SSID:";
 Blockly.Msg.wifi_hotspot_ssid = "SSID:";
 Blockly.Msg.wifi_hotspot_pass = "密码:";
 Blockly.Msg.wifi_hotspot_pass = "密码:";
 Blockly.Msg.wifi_connect_router = "连接 WiFi 网络";
 Blockly.Msg.wifi_connect_router = "连接 WiFi 网络";
+Blockly.Msg.V831_code_scanning_network = "扫码联网"
 Blockly.Msg.wifi_router_ssid = "SSID:";
 Blockly.Msg.wifi_router_ssid = "SSID:";
 Blockly.Msg.wifi_router_pass = "密码:";
 Blockly.Msg.wifi_router_pass = "密码:";
 Blockly.Msg.wifi_router_disconnect = "断开 WiFi 连接";
 Blockly.Msg.wifi_router_disconnect = "断开 WiFi 连接";
@@ -4673,7 +4674,7 @@ Blockly.Msg.ai_models_load_title = "加载预设模型:";
 Blockly.Msg.ai_models_init_hand_written_model = "开始手写数字识别";
 Blockly.Msg.ai_models_init_hand_written_model = "开始手写数字识别";
 Blockly.Msg.ai_models_init_object_model = "常见物体检测模型";
 Blockly.Msg.ai_models_init_object_model = "常见物体检测模型";
 Blockly.Msg.ai_models_init_guesswork_model = "猜拳识别模型";
 Blockly.Msg.ai_models_init_guesswork_model = "猜拳识别模型";
-Blockly.Msg.ai_models_guesswork_model_if = "检测到猜拳结果";
+Blockly.Msg.ai_models_guesswork_model_if = "在屏幕中显示识别到的猜拳结果";
 Blockly.Msg.ai_models_guesswork_model_get = "获取检测到的猜拳结果的";
 Blockly.Msg.ai_models_guesswork_model_get = "获取检测到的猜拳结果的";
 Blockly.Msg.ai_model_guesswork_look_attribute = "对检测到每一个猜拳结果";
 Blockly.Msg.ai_model_guesswork_look_attribute = "对检测到每一个猜拳结果";
 Blockly.Msg.ai_models_init_object_model_title = "常见物体检测模型(飞机、自行车、鸟,船,瓶子,公共汽车,汽车,猫,椅子,牛,餐桌,狗,马,摩托车,人,盆栽,羊,沙发,火车,电视监视器)";
 Blockly.Msg.ai_models_init_object_model_title = "常见物体检测模型(飞机、自行车、鸟,船,瓶子,公共汽车,汽车,猫,椅子,牛,餐桌,狗,马,摩托车,人,盆栽,羊,沙发,火车,电视监视器)";
@@ -4685,11 +4686,11 @@ Blockly.Msg.ai_model_digital_new_text = "对检测的每一个手写数字结果
 Blockly.Msg.ai_models_hand_written_model_result = "获取手写数字检测模型的检测结果";
 Blockly.Msg.ai_models_hand_written_model_result = "获取手写数字检测模型的检测结果";
 Blockly.Msg.ai_models_hand_written_model_number = "获取当前检测到的数字 (0至9)";
 Blockly.Msg.ai_models_hand_written_model_number = "获取当前检测到的数字 (0至9)";
 Blockly.Msg.ai_models_hand_written_model_confidence = "获取当前检测到的数字的置信度 (%)";
 Blockly.Msg.ai_models_hand_written_model_confidence = "获取当前检测到的数字的置信度 (%)";
-Blockly.Msg.ai_model_digital = "待测数字属性";
+Blockly.Msg.ai_model_digital = "在屏幕中显示识别到手写数字的结果";
 Blockly.Msg.ai_model_digital_attribute = "检测到数字";
 Blockly.Msg.ai_model_digital_attribute = "检测到数字";
 Blockly.Msg.ai_models_object_model_if = "对检测的每一个物体结果";
 Blockly.Msg.ai_models_object_model_if = "对检测的每一个物体结果";
 Blockly.Msg.ai_models_object_model_get = "获取检测到的待测物体的";
 Blockly.Msg.ai_models_object_model_get = "获取检测到的待测物体的";
-Blockly.Msg.ai_model_look_attribute = "检测到物体";
+Blockly.Msg.ai_model_look_attribute = "在屏幕中显示识别物体的结果";
 Blockly.Msg.ai_models_object_model_name = "物体名称";
 Blockly.Msg.ai_models_object_model_name = "物体名称";
 Blockly.Msg.ai_models_object_model_x = "检测框起点 X 轴坐标";
 Blockly.Msg.ai_models_object_model_x = "检测框起点 X 轴坐标";
 Blockly.Msg.ai_models_object_model_y = "检测框起点 Y 轴坐标";
 Blockly.Msg.ai_models_object_model_y = "检测框起点 Y 轴坐标";
@@ -4698,9 +4699,9 @@ Blockly.Msg.ai_models_object_model_h = "检测框终点 Y 轴坐标";
 Blockly.Msg.ai_models_object_model_count = "物体数量";
 Blockly.Msg.ai_models_object_model_count = "物体数量";
 Blockly.Msg.ai_models_object_model_index = "出现顺序";
 Blockly.Msg.ai_models_object_model_index = "出现顺序";
 Blockly.Msg.ai_models_object_model_confidence = "置信度";
 Blockly.Msg.ai_models_object_model_confidence = "置信度";
-Blockly.Msg.ai_models_face_model_if_new = "识别到人脸";
+Blockly.Msg.ai_models_face_model_if_new = "在屏幕中显示識別到的人脸信息";
 Blockly.Msg.ai_model_face_attribute_new = "对识别的每一个人脸";
 Blockly.Msg.ai_model_face_attribute_new = "对识别的每一个人脸";
-Blockly.Msg.ai_models_face_model_if = "检测到人脸";
+Blockly.Msg.ai_models_face_model_if = "在屏幕中显示检测到人脸结果";
 Blockly.Msg.ai_model_face_attribute = "人脸属性";
 Blockly.Msg.ai_model_face_attribute = "人脸属性";
 Blockly.Msg.ai_models_face_model_get = "获取检测到的人脸的";
 Blockly.Msg.ai_models_face_model_get = "获取检测到的人脸的";
 Blockly.Msg.ai_models_face_model_x = "检测框起点 X轴坐标";
 Blockly.Msg.ai_models_face_model_x = "检测框起点 X轴坐标";
@@ -4720,7 +4721,7 @@ Blockly.Msg.ai_models_human_model_get = "获取检测到的人体的";
 Blockly.Msg.ai_models_init_humane_model = "人体检测模型";
 Blockly.Msg.ai_models_init_humane_model = "人体检测模型";
 Blockly.Msg.ai_models_init_card_model = "车牌识别模型";
 Blockly.Msg.ai_models_init_card_model = "车牌识别模型";
 Blockly.Msg.ai_models_init_card_result = "车牌结果";
 Blockly.Msg.ai_models_init_card_result = "车牌结果";
-Blockly.Msg.ai_models_card_if_true = "检测到车牌";
+Blockly.Msg.ai_models_card_if_true = "在屏幕中显示检测到车牌的结果";
 Blockly.Msg.ai_models_card_attribute = "对检测到的每一个车牌";
 Blockly.Msg.ai_models_card_attribute = "对检测到的每一个车牌";
 Blockly.Msg.ai_models_card_model_get = "获取检测到车牌的";
 Blockly.Msg.ai_models_card_model_get = "获取检测到车牌的";
 
 
@@ -4739,7 +4740,7 @@ Blockly.Msg.ai_models_customized_init_type_set_fast = "识别单张人脸(速
 Blockly.Msg.ai_models_customized_init_type_set_slow = "识别多张人脸(速度慢):";
 Blockly.Msg.ai_models_customized_init_type_set_slow = "识别多张人脸(速度慢):";
 
 
 Blockly.Msg.ai_models_customized_init_setup_name = "设置模型识别物体的名称:";
 Blockly.Msg.ai_models_customized_init_setup_name = "设置模型识别物体的名称:";
-Blockly.Msg.ai_models_customized_if_got = "识别到了自定义模型的对象";
+Blockly.Msg.ai_models_customized_if_got = "在屏幕中显示自定义识别结果";
 Blockly.Msg.ai_model_customized_attribute = "对识别到的每一个自定义模型对象";
 Blockly.Msg.ai_model_customized_attribute = "对识别到的每一个自定义模型对象";
 Blockly.Msg.ai_models_customized_get_result_any = "获取识别到自定义模型结果的";
 Blockly.Msg.ai_models_customized_get_result_any = "获取识别到自定义模型结果的";
 Blockly.Msg.ai_models_customized_get_result_name = "名称";
 Blockly.Msg.ai_models_customized_get_result_name = "名称";

+ 9 - 7
blockly/msg/js/zh-hant.js

@@ -4198,6 +4198,7 @@ Blockly.Msg.wifi_setup_hotspot = "建立 Wi-Fi 熱點";
 Blockly.Msg.wifi_hotspot_ssid = "SSID:";
 Blockly.Msg.wifi_hotspot_ssid = "SSID:";
 Blockly.Msg.wifi_hotspot_pass = "密碼:";
 Blockly.Msg.wifi_hotspot_pass = "密碼:";
 Blockly.Msg.wifi_connect_router = "連接 WiFi 網絡";
 Blockly.Msg.wifi_connect_router = "連接 WiFi 網絡";
+Blockly.Msg.V831_code_scanning_network = "掃碼聯網"
 Blockly.Msg.wifi_router_ssid = "SSID:";
 Blockly.Msg.wifi_router_ssid = "SSID:";
 Blockly.Msg.wifi_router_pass = "密碼:";
 Blockly.Msg.wifi_router_pass = "密碼:";
 Blockly.Msg.wifi_router_disconnect = "斷開 WiFi 連接";
 Blockly.Msg.wifi_router_disconnect = "斷開 WiFi 連接";
@@ -5139,7 +5140,7 @@ Blockly.Msg.ai_models_load_title = "加載預設模型:";
 Blockly.Msg.ai_models_init_hand_written_model = "開始手寫數字識別";
 Blockly.Msg.ai_models_init_hand_written_model = "開始手寫數字識別";
 Blockly.Msg.ai_models_init_object_model = "常見物體檢測模型";
 Blockly.Msg.ai_models_init_object_model = "常見物體檢測模型";
 Blockly.Msg.ai_models_init_guesswork_model = "猜拳識別模型";
 Blockly.Msg.ai_models_init_guesswork_model = "猜拳識別模型";
-Blockly.Msg.ai_models_guesswork_model_if = "檢測到猜拳結果";
+Blockly.Msg.ai_models_guesswork_model_if = "在屏幕中顯示識別到的猜拳結果";
 Blockly.Msg.ai_models_guesswork_model_get = "獲取檢測到猜拳結果的";
 Blockly.Msg.ai_models_guesswork_model_get = "獲取檢測到猜拳結果的";
 Blockly.Msg.ai_model_guesswork_look_attribute = "對檢測到每一個猜拳結果";
 Blockly.Msg.ai_model_guesswork_look_attribute = "對檢測到每一個猜拳結果";
 Blockly.Msg.ai_models_init_object_model_title = "常見物體檢測模型(飛機、自行車、鳥,船,瓶子,公共汽車,汽車,貓,椅子,牛,餐桌,狗,馬,摩托車,人,盆栽,羊,沙發,火車,電視監視器)";
 Blockly.Msg.ai_models_init_object_model_title = "常見物體檢測模型(飛機、自行車、鳥,船,瓶子,公共汽車,汽車,貓,椅子,牛,餐桌,狗,馬,摩托車,人,盆栽,羊,沙發,火車,電視監視器)";
@@ -5147,14 +5148,15 @@ Blockly.Msg.ai_models_init_face_model = "人臉檢測模型";
 Blockly.Msg.ai_camera_camera_fit_set1 = "設定相機捕捉的畫面爲:";
 Blockly.Msg.ai_camera_camera_fit_set1 = "設定相機捕捉的畫面爲:";
 Blockly.Msg.ai_models_init_source = "設定要檢測的圖像源爲:";
 Blockly.Msg.ai_models_init_source = "設定要檢測的圖像源爲:";
 Blockly.Msg.ai_models_init_source_written = "設置要檢測手寫數字識別的圖像源爲::";
 Blockly.Msg.ai_models_init_source_written = "設置要檢測手寫數字識別的圖像源爲::";
+Blockly.Msg.ai_model_digital_new_text = "對檢測的每一個手寫數字結果"
 Blockly.Msg.ai_models_hand_written_model_result = "獲取手寫數字檢測模型的檢測結果";
 Blockly.Msg.ai_models_hand_written_model_result = "獲取手寫數字檢測模型的檢測結果";
 Blockly.Msg.ai_models_hand_written_model_number = "獲取當前檢測到的數字 (0至9)";
 Blockly.Msg.ai_models_hand_written_model_number = "獲取當前檢測到的數字 (0至9)";
 Blockly.Msg.ai_models_hand_written_model_confidence = "獲取當前檢測到的數字的可信度 (%)";
 Blockly.Msg.ai_models_hand_written_model_confidence = "獲取當前檢測到的數字的可信度 (%)";
-Blockly.Msg.ai_model_digital = "待測數字屬性";
+Blockly.Msg.ai_model_digital = "在屏幕中顯示識別到手寫數字的結果";
 Blockly.Msg.ai_model_digital_attribute = "檢測到數字";
 Blockly.Msg.ai_model_digital_attribute = "檢測到數字";
 Blockly.Msg.ai_models_object_model_if = "檢測到待測物體";
 Blockly.Msg.ai_models_object_model_if = "檢測到待測物體";
 Blockly.Msg.ai_models_object_model_get = "獲取檢測到的待測物體的";
 Blockly.Msg.ai_models_object_model_get = "獲取檢測到的待測物體的";
-Blockly.Msg.ai_model_look_attribute = "檢測到物體";
+Blockly.Msg.ai_model_look_attribute = "在屏幕中顯示識別物體的結果";
 Blockly.Msg.ai_models_object_model_name = "物體名稱";
 Blockly.Msg.ai_models_object_model_name = "物體名稱";
 Blockly.Msg.ai_models_object_model_x = "檢測框起點 X 軸座標";
 Blockly.Msg.ai_models_object_model_x = "檢測框起點 X 軸座標";
 Blockly.Msg.ai_models_object_model_y = "檢測框起點 Y 軸座標";
 Blockly.Msg.ai_models_object_model_y = "檢測框起點 Y 軸座標";
@@ -5163,9 +5165,9 @@ Blockly.Msg.ai_models_object_model_h = "檢測框終點 Y 軸座標";
 Blockly.Msg.ai_models_object_model_count = "物體數量";
 Blockly.Msg.ai_models_object_model_count = "物體數量";
 Blockly.Msg.ai_models_object_model_index = "出現順序";
 Blockly.Msg.ai_models_object_model_index = "出現順序";
 Blockly.Msg.ai_models_object_model_confidence = "可信度";
 Blockly.Msg.ai_models_object_model_confidence = "可信度";
-Blockly.Msg.ai_models_face_model_if_new = "識別到人臉";
+Blockly.Msg.ai_models_face_model_if_new = "在屏幕中顯示識別到人臉信息";
 Blockly.Msg.ai_model_face_attribute_new = "對識別到的每一個人臉";
 Blockly.Msg.ai_model_face_attribute_new = "對識別到的每一個人臉";
-Blockly.Msg.ai_models_face_model_if = "檢測到人臉";
+Blockly.Msg.ai_models_face_model_if = "在屏幕中顯示檢測到人臉結果";
 Blockly.Msg.ai_model_face_attribute = "人臉屬性";
 Blockly.Msg.ai_model_face_attribute = "人臉屬性";
 Blockly.Msg.ai_models_face_model_get = "獲取檢測到的人臉的";
 Blockly.Msg.ai_models_face_model_get = "獲取檢測到的人臉的";
 Blockly.Msg.ai_models_face_model_x = "檢測框起點 X 軸座標";
 Blockly.Msg.ai_models_face_model_x = "檢測框起點 X 軸座標";
@@ -5185,7 +5187,7 @@ Blockly.Msg.ai_models_human_model_get = "獲取檢測到的人體的";
 Blockly.Msg.ai_models_init_humane_model = "人體檢測模型";
 Blockly.Msg.ai_models_init_humane_model = "人體檢測模型";
 Blockly.Msg.ai_models_init_card_model = "車牌識別模型";
 Blockly.Msg.ai_models_init_card_model = "車牌識別模型";
 Blockly.Msg.ai_models_init_card_result = "車牌結果";
 Blockly.Msg.ai_models_init_card_result = "車牌結果";
-Blockly.Msg.ai_models_card_if_true = "檢測到車牌";
+Blockly.Msg.ai_models_card_if_true = "在屏幕中顯示檢測到車牌的結果";
 Blockly.Msg.ai_models_card_attribute = "對檢測到的每一個車牌";
 Blockly.Msg.ai_models_card_attribute = "對檢測到的每一個車牌";
 Blockly.Msg.ai_models_card_model_get = "獲取檢測到車牌的";
 Blockly.Msg.ai_models_card_model_get = "獲取檢測到車牌的";
 
 
@@ -5203,7 +5205,7 @@ Blockly.Msg.ai_models_customized_init_type_set_fast = "識別單張人臉(速
 Blockly.Msg.ai_models_customized_init_type_set_slow = "識別多張人臉(速度慢):";
 Blockly.Msg.ai_models_customized_init_type_set_slow = "識別多張人臉(速度慢):";
 
 
 Blockly.Msg.ai_models_customized_init_setup_name = "設定模型識別物體的名稱:";
 Blockly.Msg.ai_models_customized_init_setup_name = "設定模型識別物體的名稱:";
-Blockly.Msg.ai_models_customized_if_got = "識別到了客製化模型的物件";
+Blockly.Msg.ai_models_customized_if_got = "在屏幕中顯示自定義識別結果";
 Blockly.Msg.ai_model_customized_attribute = "對識別到每一個客製化模型對象";
 Blockly.Msg.ai_model_customized_attribute = "對識別到每一個客製化模型對象";
 Blockly.Msg.ai_models_customized_get_result_any = "獲取識別到客製化模型結果的";
 Blockly.Msg.ai_models_customized_get_result_any = "獲取識別到客製化模型結果的";
 Blockly.Msg.ai_models_customized_get_result_name = "名稱";
 Blockly.Msg.ai_models_customized_get_result_name = "名稱";

+ 8 - 7
src/editor.js

@@ -2619,8 +2619,8 @@ BlockPyEditor.CATEGORY_MAP = {
         '<label id="basis_number_recognition" text="Basis number recognition" web-class="myLabelStyle" style="font-size:20px;"></label>' +
         '<label id="basis_number_recognition" text="Basis number recognition" web-class="myLabelStyle" style="font-size:20px;"></label>' +
         // '<block type="ai_model_digital_init"></block>' +
         // '<block type="ai_model_digital_init"></block>' +
         '<block type="ai_model_digital_init_loding"></block>' +
         '<block type="ai_model_digital_init_loding"></block>' +
-        '<block type="ai_model_digital_attribute"></block>' +
-        // '<block type="ai_model_digital"></block>' +
+        // '<block type="ai_model_digital_attribute"></block>' +
+        '<block type="ai_model_digital"></block>' +
         '<block type="ai_model_digital_new"></block>' +
         '<block type="ai_model_digital_new"></block>' +
         '<block type="ai_model_digital_result"></block>' +
         '<block type="ai_model_digital_result"></block>' +
         '<label id="basis_object_recognition" text="Basis object recognition" web-class="myLabelStyle" style="font-size:20px;"></label>' +
         '<label id="basis_object_recognition" text="Basis object recognition" web-class="myLabelStyle" style="font-size:20px;"></label>' +
@@ -2673,7 +2673,7 @@ BlockPyEditor.CATEGORY_MAP = {
         '<block type="face_recognition_if_face"></block>' +
         '<block type="face_recognition_if_face"></block>' +
         '<block type="face_recognition_if_face_new"></block>' +
         '<block type="face_recognition_if_face_new"></block>' +
         '<block type="face_recognition_detection_rectangle"></block>' +
         '<block type="face_recognition_detection_rectangle"></block>' +
-        '<block type="face_recognition_map_face"></block>' +
+        // '<block type="face_recognition_map_face"></block>' +
         // '<block type="face_recognition_face_result"></block>' +
         // '<block type="face_recognition_face_result"></block>' +
         '<block type="face_recognition_add"></block>' +
         '<block type="face_recognition_add"></block>' +
         '<block type="face_recognition_remove"></block>' +
         '<block type="face_recognition_remove"></block>' +
@@ -2731,9 +2731,9 @@ BlockPyEditor.CATEGORY_MAP = {
         '   </value>' +
         '   </value>' +
         '</block>' +
         '</block>' +
         '<block type="ai_model_self_learning_add_class"></block>' +
         '<block type="ai_model_self_learning_add_class"></block>' +
-        '<block type="ai_model_self_learning_make_data_set"></block>' +
+        // '<block type="ai_model_self_learning_make_data_set"></block>' +
         '<block type="ai_model_self_learning_picture"></block>' +
         '<block type="ai_model_self_learning_picture"></block>' +
-        '<block type="ai_model_self_learning_save_modal"></block>' +
+        // '<block type="ai_model_self_learning_save_modal"></block>' +
         '<block type="ai_model_self_learning_class_verification"></block>' +
         '<block type="ai_model_self_learning_class_verification"></block>' +
         '<block type="ai_model_self_learning_result"></block>' +
         '<block type="ai_model_self_learning_result"></block>' +
 
 
@@ -2826,8 +2826,8 @@ BlockPyEditor.CATEGORY_MAP = {
         '<block type="speech_recognition_phonetic_to_pinyin_pause_recognition"></block>' +
         '<block type="speech_recognition_phonetic_to_pinyin_pause_recognition"></block>' +
         '<block type="speech_recognition_phonetic_to_pinyin_get_result"></block>' +
         '<block type="speech_recognition_phonetic_to_pinyin_get_result"></block>' +
         '<label id="" text="Numpy 神经网络" web-class="myLabelStyle" style="font-size:20px;"></label>' +
         '<label id="" text="Numpy 神经网络" web-class="myLabelStyle" style="font-size:20px;"></label>' +
-        // '<block type="Numpy_Neural_Network_init">' +
-        // '</block>' +
+        '<block type="Numpy_Neural_Network_init">' +
+        '</block>' +
         '<block type="Numpy_Neural_Network_load">' +
         '<block type="Numpy_Neural_Network_load">' +
         '</block>' +
         '</block>' +
         '<block type="Numpy_Neural_Network_LOading_test_train">' +
         '<block type="Numpy_Neural_Network_LOading_test_train">' +
@@ -3177,6 +3177,7 @@ BlockPyEditor.CATEGORY_MAP = {
     'IOT':
     'IOT':
         '<category id="IOT" name="IOT" colour="#7e3cca">' +
         '<category id="IOT" name="IOT" colour="#7e3cca">' +
         '<category id="" name="Wi-Fi" colour="#3062c1">' +
         '<category id="" name="Wi-Fi" colour="#3062c1">' +
+        '<block type="V831_code_scanning_network"></block>' +
         '<block type="esp32_main_controller_wifi_connect_internet">' +
         '<block type="esp32_main_controller_wifi_connect_internet">' +
         '      <value name="ssid">' +
         '      <value name="ssid">' +
         '       <shadow type="text">' +
         '       <shadow type="text">' +

+ 238 - 271
src/python/AI/numpyMnist训练模型.xml

@@ -1,225 +1,195 @@
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
-  <block type="ai_lcd_screeninit" id="a3n`:ur[V=sDMp[{~yxr" x="316" y="4">
-    <field name="isScreen">False</field>
+  <block type="Numpy_Neural_Network_init" id="oU.y;4x-XE7a=(b4W4Ey" x="68" y="-54">
     <next>
     <next>
-      <block type="ai_lcd_createnonecarvas" id="OL;T[bn[uL3N)y.h.IDP">
-        <field name="varitem">canvas</field>
-        <value name="wh">
-          <block type="lcd_set_width_height" id="|Wq!@WOA|2RKQMOeLjlK">
-            <value name="WIDTH">
-              <shadow type="math_number" id="|RPt/PCzx1X{,Mpa1d|^">
-                <field name="NUM">320</field>
-              </shadow>
-            </value>
-            <value name="HEIGHT">
-              <shadow type="math_number" id="L%*H)XLhbB7)~u83kSqG">
-                <field name="NUM">240</field>
-              </shadow>
-            </value>
+      <block type="Numpy_Neural_Network_LOading_test_train" id="q:Nx|D{_64X%tKF1h8Vf">
+        <value name="class_input">
+          <block type="text" id="rap}a`0^my=_;B]%yD^t">
+            <field name="TEXT">/root/preset/training/res/mnist_train_100.csv</field>
+          </block>
+        </value>
+        <value name="class_input1">
+          <block type="text" id="_k/ks[CSyG?x-#C04BvL">
+            <field name="TEXT">/root/preset/training/res/mnist_test_10.csv</field>
           </block>
           </block>
         </value>
         </value>
         <next>
         <next>
-          <block type="Numpy_Neural_Network_init" id="Ctim5O:0p(zs1l:P!w}I">
-            <next>
-              <block type="Numpy_Neural_Network_LOading_test_train" id="(wo+BYWA[W`i3-Wh3a!A">
-                <value name="class_input">
-                  <block type="text" id="sd|O/6I]r?:G$)hB6*18">
-                    <field name="TEXT">/root/preset/training/res/mnist_train_100.csv</field>
-                  </block>
+          <block type="controls_repeat_forever" id="q{_O(;h]*=EM#(cDXA`C">
+            <statement name="DO">
+              <block type="controls_if" id="U.In.z}lZ07.b/*N~dA_">
+                <mutation else="1"></mutation>
+                <value name="IF0">
+                  <block type="Numpy_Neural_Network_numpy_isStart" id="-GZRIQVz$x.0Z8NfG)Dw"></block>
                 </value>
                 </value>
-                <value name="class_input1">
-                  <block type="text" id="XwiY!RcjpcF_WD83MraH">
-                    <field name="TEXT">/root/preset/training/res/mnist_test_10.csv</field>
-                  </block>
-                </value>
-                <next>
-                  <block type="controls_repeat_forever" id="?RP!;)I2o:40f-N_8)N=">
-                    <statement name="DO">
-                      <block type="controls_if" id="U.In.z}lZ07.b/*N~dA_">
-                        <mutation else="1"></mutation>
-                        <value name="IF0">
-                          <block type="Numpy_Neural_Network_numpy_isStart" id="-GZRIQVz$x.0Z8NfG)Dw"></block>
+                <statement name="DO0">
+                  <block type="ai_lcd_textcarvas" id=":dt;{!#{e8?lGIovcWF+">
+                    <value name="POSA">
+                      <block type="lcd_set_position" id="74m(rHCdR~NkdC*F27S6">
+                        <value name="POSX">
+                          <shadow type="math_number" id="fT~H}eL_[|,YNH{haXsc">
+                            <field name="NUM">12</field>
+                          </shadow>
                         </value>
                         </value>
-                        <statement name="DO0">
-                          <block type="ai_lcd_textcarvas" id=":dt;{!#{e8?lGIovcWF+">
-                            <field name="varitem">canvas</field>
-                            <value name="POSA">
-                              <block type="lcd_set_position" id="74m(rHCdR~NkdC*F27S6">
-                                <value name="POSX">
-                                  <shadow type="math_number" id="fT~H}eL_[|,YNH{haXsc">
-                                    <field name="NUM">12</field>
-                                  </shadow>
-                                </value>
-                                <value name="POSY">
-                                  <shadow type="math_number" id="0oN=CmpZUwXqsbSl.{0b">
-                                    <field name="NUM">8</field>
-                                  </shadow>
-                                </value>
-                              </block>
-                            </value>
-                            <value name="CONTENT">
-                              <shadow type="text" id="57(;|[akYt|9Scbyv7/c">
-                                <field name="TEXT">构建神经网络训练服务...</field>
+                        <value name="POSY">
+                          <shadow type="math_number" id="0oN=CmpZUwXqsbSl.{0b">
+                            <field name="NUM">8</field>
+                          </shadow>
+                        </value>
+                      </block>
+                    </value>
+                    <value name="CONTENT">
+                      <shadow type="text" id="57(;|[akYt|9Scbyv7/c">
+                        <field name="TEXT">构建神经网络训练服务...</field>
+                      </shadow>
+                    </value>
+                    <value name="COLOR">
+                      <block type="lcd_set_color" id="`B@L-k,r%)KT*GECDV#R">
+                        <field name="COLOR">#ffffff</field>
+                      </block>
+                    </value>
+                    <value name="Scale">
+                      <shadow type="math_number" id="H~:X,`FsS4R=_HU=e0:(">
+                        <field name="NUM">1</field>
+                      </shadow>
+                    </value>
+                    <next>
+                      <block type="ai_lcd_textcarvas" id="1^Id6n+$rbD~}7;))2)Q">
+                        <value name="POSA">
+                          <block type="lcd_set_position" id="ZjZ@2FL9bG.RLMU1Wr)|">
+                            <value name="POSX">
+                              <shadow type="math_number" id="JG1Ab,d|n{jm:@69(je^">
+                                <field name="NUM">12</field>
                               </shadow>
                               </shadow>
                             </value>
                             </value>
-                            <value name="COLOR">
-                              <block type="lcd_set_color" id="`B@L-k,r%)KT*GECDV#R">
-                                <field name="COLOR">#ffffff</field>
-                              </block>
-                            </value>
-                            <value name="Scale">
-                              <shadow type="math_number" id="H~:X,`FsS4R=_HU=e0:(">
-                                <field name="NUM">1</field>
+                            <value name="POSY">
+                              <shadow type="math_number" id="~l,T!_h{JV~*;$$g;/t(">
+                                <field name="NUM">28</field>
                               </shadow>
                               </shadow>
                             </value>
                             </value>
+                          </block>
+                        </value>
+                        <value name="CONTENT">
+                          <shadow type="text" id="8O9zs9Cg5z*@|h:BP45v">
+                            <field name="TEXT">训练开始</field>
+                          </shadow>
+                        </value>
+                        <value name="COLOR">
+                          <block type="lcd_set_color" id="Lt/o=eHws0CU0CXaqldv">
+                            <field name="COLOR">#ffffff</field>
+                          </block>
+                        </value>
+                        <value name="Scale">
+                          <shadow type="math_number" id="f97L`@KTY#^FncH:|iaV">
+                            <field name="NUM">1</field>
+                          </shadow>
+                        </value>
+                        <next>
+                          <block type="ai_lcd_showcarvas_set_display" id="0r;W~SBbLkJHf!R0{OiE">
                             <next>
                             <next>
-                              <block type="ai_lcd_textcarvas" id="1^Id6n+$rbD~}7;))2)Q">
-                                <field name="varitem">canvas</field>
-                                <value name="POSA">
-                                  <block type="lcd_set_position" id="ZjZ@2FL9bG.RLMU1Wr)|">
-                                    <value name="POSX">
-                                      <shadow type="math_number" id="JG1Ab,d|n{jm:@69(je^">
-                                        <field name="NUM">12</field>
-                                      </shadow>
-                                    </value>
-                                    <value name="POSY">
-                                      <shadow type="math_number" id="~l,T!_h{JV~*;$$g;/t(">
-                                        <field name="NUM">28</field>
-                                      </shadow>
-                                    </value>
+                              <block type="Numpy_Neural_Network_setting_training_argument" id="dHmJRjJ6~o~p:-rnQy]k">
+                                <value name="class_input">
+                                  <block type="text" id="8ZTM8l$94~m1NJ)o/N~q">
+                                    <field name="TEXT">784</field>
+                                  </block>
+                                </value>
+                                <value name="class_input1">
+                                  <block type="text" id="G.oF2#EB0q7HZVN_{|MH">
+                                    <field name="TEXT">128</field>
                                   </block>
                                   </block>
                                 </value>
                                 </value>
-                                <value name="CONTENT">
-                                  <shadow type="text" id="8O9zs9Cg5z*@|h:BP45v">
-                                    <field name="TEXT">训练开始</field>
-                                  </shadow>
+                                <value name="class_input2">
+                                  <block type="text" id="t4VnPQ*sBr^xw4$|fHM=">
+                                    <field name="TEXT">10</field>
+                                  </block>
                                 </value>
                                 </value>
-                                <value name="COLOR">
-                                  <block type="lcd_set_color" id="Lt/o=eHws0CU0CXaqldv">
-                                    <field name="COLOR">#ffffff</field>
+                                <value name="class_input3">
+                                  <block type="text" id="jpEa$=*vBo5O%9@9m$v.">
+                                    <field name="TEXT">0.1</field>
                                   </block>
                                   </block>
                                 </value>
                                 </value>
-                                <value name="Scale">
-                                  <shadow type="math_number" id="f97L`@KTY#^FncH:|iaV">
-                                    <field name="NUM">1</field>
-                                  </shadow>
+                                <value name="class_input4">
+                                  <block type="text" id="[}4e?kn]7Nww#|rR:fe$">
+                                    <field name="TEXT">10</field>
+                                  </block>
+                                </value>
+                                <value name="class_input5">
+                                  <block type="text" id="wL)muctDMWIy#uE-!Xz2">
+                                    <field name="TEXT">/root/user/model/NN.pkl</field>
+                                  </block>
                                 </value>
                                 </value>
                                 <next>
                                 <next>
-                                  <block type="ai_lcd_showcarvas_set_display" id="0r;W~SBbLkJHf!R0{OiE">
-                                    <field name="varitem">canvas</field>
-                                    <next>
-                                      <block type="Numpy_Neural_Network_setting_training_argument" id="dHmJRjJ6~o~p:-rnQy]k">
-                                        <value name="class_input">
-                                          <block type="text" id="8ZTM8l$94~m1NJ)o/N~q">
-                                            <field name="TEXT">784</field>
-                                          </block>
+                                  <block type="ai_lcd_textcarvas" id="O$7,mr0-myw]TCs^^vW7">
+                                    <value name="POSA">
+                                      <block type="lcd_set_position" id="#DJh)Ul.I)SkyhrgL5i3">
+                                        <value name="POSX">
+                                          <shadow type="math_number" id="8AefAR`Apg#j`BQAA0K.">
+                                            <field name="NUM">12</field>
+                                          </shadow>
                                         </value>
                                         </value>
-                                        <value name="class_input1">
-                                          <block type="text" id="G.oF2#EB0q7HZVN_{|MH">
-                                            <field name="TEXT">128</field>
-                                          </block>
+                                        <value name="POSY">
+                                          <shadow type="math_number" id="GV%a2y)*#;?Vld|RF2nN">
+                                            <field name="NUM">48</field>
+                                          </shadow>
                                         </value>
                                         </value>
-                                        <value name="class_input2">
-                                          <block type="text" id="t4VnPQ*sBr^xw4$|fHM=">
-                                            <field name="TEXT">10</field>
+                                      </block>
+                                    </value>
+                                    <value name="CONTENT">
+                                      <shadow type="text" id="MbGl|}a5GD|)vjY$])8L">
+                                        <field name="TEXT">模型训练已完成</field>
+                                      </shadow>
+                                    </value>
+                                    <value name="COLOR">
+                                      <block type="lcd_set_color" id="Sj1LjVdSlv0?RJ3l_sQ5">
+                                        <field name="COLOR">#ffffff</field>
+                                      </block>
+                                    </value>
+                                    <value name="Scale">
+                                      <shadow type="math_number" id="dg9XoI6822A-kLQ5+79+">
+                                        <field name="NUM">1</field>
+                                      </shadow>
+                                    </value>
+                                    <next>
+                                      <block type="ai_lcd_textcarvas" id="vNRQ#).!i-aewT~T65L0">
+                                        <value name="POSA">
+                                          <block type="lcd_set_position" id="C-c+C9/R]uvlM2@1+e]H">
+                                            <value name="POSX">
+                                              <shadow type="math_number" id="KOEz3s`-PXJv3N2d1WQe">
+                                                <field name="NUM">12</field>
+                                              </shadow>
+                                            </value>
+                                            <value name="POSY">
+                                              <shadow type="math_number" id="xizVzpJS-Nzdhf3%1gwx">
+                                                <field name="NUM">68</field>
+                                              </shadow>
+                                            </value>
                                           </block>
                                           </block>
                                         </value>
                                         </value>
-                                        <value name="class_input3">
-                                          <block type="text" id="jpEa$=*vBo5O%9@9m$v.">
-                                            <field name="TEXT">0.1</field>
-                                          </block>
+                                        <value name="CONTENT">
+                                          <shadow type="text" id="8!A^z}0O0*$#aQ_{r+Sa">
+                                            <field name="TEXT">程序将自动退出</field>
+                                          </shadow>
                                         </value>
                                         </value>
-                                        <value name="class_input4">
-                                          <block type="text" id="[}4e?kn]7Nww#|rR:fe$">
-                                            <field name="TEXT">10</field>
+                                        <value name="COLOR">
+                                          <block type="lcd_set_color" id="jebhEPD+PkCCYzI[}CUL">
+                                            <field name="COLOR">#ffffff</field>
                                           </block>
                                           </block>
                                         </value>
                                         </value>
-                                        <value name="class_input5">
-                                          <block type="text" id="wL)muctDMWIy#uE-!Xz2">
-                                            <field name="TEXT">/root/user/model/NN.pkl</field>
-                                          </block>
+                                        <value name="Scale">
+                                          <shadow type="math_number" id="rrvN$=|;MI6c`}l8C*o:">
+                                            <field name="NUM">1</field>
+                                          </shadow>
                                         </value>
                                         </value>
                                         <next>
                                         <next>
-                                          <block type="ai_lcd_textcarvas" id="O$7,mr0-myw]TCs^^vW7">
-                                            <field name="varitem">canvas</field>
-                                            <value name="POSA">
-                                              <block type="lcd_set_position" id="#DJh)Ul.I)SkyhrgL5i3">
-                                                <value name="POSX">
-                                                  <shadow type="math_number" id="8AefAR`Apg#j`BQAA0K.">
-                                                    <field name="NUM">12</field>
-                                                  </shadow>
-                                                </value>
-                                                <value name="POSY">
-                                                  <shadow type="math_number" id="GV%a2y)*#;?Vld|RF2nN">
-                                                    <field name="NUM">48</field>
-                                                  </shadow>
-                                                </value>
-                                              </block>
-                                            </value>
-                                            <value name="CONTENT">
-                                              <shadow type="text" id="MbGl|}a5GD|)vjY$])8L">
-                                                <field name="TEXT">模型训练已完成</field>
-                                              </shadow>
-                                            </value>
-                                            <value name="COLOR">
-                                              <block type="lcd_set_color" id="Sj1LjVdSlv0?RJ3l_sQ5">
-                                                <field name="COLOR">#ffffff</field>
-                                              </block>
-                                            </value>
-                                            <value name="Scale">
-                                              <shadow type="math_number" id="dg9XoI6822A-kLQ5+79+">
-                                                <field name="NUM">1</field>
-                                              </shadow>
-                                            </value>
+                                          <block type="ai_lcd_showcarvas_set_display" id="gk)3M-J@j6}X+?{Dv(yw">
                                             <next>
                                             <next>
-                                              <block type="ai_lcd_textcarvas" id="vNRQ#).!i-aewT~T65L0">
-                                                <field name="varitem">canvas</field>
-                                                <value name="POSA">
-                                                  <block type="lcd_set_position" id="C-c+C9/R]uvlM2@1+e]H">
-                                                    <value name="POSX">
-                                                      <shadow type="math_number" id="KOEz3s`-PXJv3N2d1WQe">
-                                                        <field name="NUM">12</field>
-                                                      </shadow>
-                                                    </value>
-                                                    <value name="POSY">
-                                                      <shadow type="math_number" id="xizVzpJS-Nzdhf3%1gwx">
-                                                        <field name="NUM">68</field>
-                                                      </shadow>
-                                                    </value>
-                                                  </block>
-                                                </value>
-                                                <value name="CONTENT">
-                                                  <shadow type="text" id="8!A^z}0O0*$#aQ_{r+Sa">
-                                                    <field name="TEXT">程序将自动退出</field>
-                                                  </shadow>
-                                                </value>
-                                                <value name="COLOR">
-                                                  <block type="lcd_set_color" id="jebhEPD+PkCCYzI[}CUL">
-                                                    <field name="COLOR">#ffffff</field>
+                                              <block type="time_delay" id="B^5R/Y~U4/b#iFt2hfS}">
+                                                <value name="DELAY_TIME_MILI">
+                                                  <block type="math_number" id="qA|Z+ZiJp*|S?QGE/,2_">
+                                                    <field name="NUM">3000</field>
                                                   </block>
                                                   </block>
                                                 </value>
                                                 </value>
-                                                <value name="Scale">
-                                                  <shadow type="math_number" id="rrvN$=|;MI6c`}l8C*o:">
-                                                    <field name="NUM">1</field>
-                                                  </shadow>
-                                                </value>
                                                 <next>
                                                 <next>
-                                                  <block type="ai_lcd_showcarvas_set_display" id="gk)3M-J@j6}X+?{Dv(yw">
-                                                    <field name="varitem">canvas</field>
-                                                    <next>
-                                                      <block type="time_delay" id="B^5R/Y~U4/b#iFt2hfS}">
-                                                        <value name="DELAY_TIME_MILI">
-                                                          <block type="math_number" id="qA|Z+ZiJp*|S?QGE/,2_">
-                                                            <field name="NUM">3000</field>
-                                                          </block>
-                                                        </value>
-                                                        <next>
-                                                          <block type="controls_flow_statements" id="?Bs]`9Y-qYH5#-6:Oki.">
-                                                            <field name="FLOW">BREAK</field>
-                                                          </block>
-                                                        </next>
-                                                      </block>
-                                                    </next>
+                                                  <block type="controls_flow_statements" id="?Bs]`9Y-qYH5#-6:Oki.">
+                                                    <field name="FLOW">BREAK</field>
                                                   </block>
                                                   </block>
                                                 </next>
                                                 </next>
                                               </block>
                                               </block>
@@ -233,90 +203,87 @@
                               </block>
                               </block>
                             </next>
                             </next>
                           </block>
                           </block>
-                        </statement>
-                        <statement name="ELSE">
-                          <block type="ai_lcd_textcarvas" id="~Z3zvb/Ssar^^iirx:xv">
-                            <field name="varitem">canvas</field>
-                            <value name="POSA">
-                              <block type="lcd_set_position" id="9nd`]WwmH=o!#j4DuIdw">
-                                <value name="POSX">
-                                  <shadow type="math_number" id="skFf3sKoo@;KX:VLXS3i">
-                                    <field name="NUM">12</field>
-                                  </shadow>
-                                </value>
-                                <value name="POSY">
-                                  <shadow type="math_number" id="[q25Nh[I9M!D0ydd;!bY">
-                                    <field name="NUM">28</field>
-                                  </shadow>
-                                </value>
-                              </block>
-                            </value>
-                            <value name="CONTENT">
-                              <shadow type="text" id="Bj(v4_yu%2^X3d7UZRN+">
-                                <field name="TEXT">已成功加载numpy.random模块</field>
+                        </next>
+                      </block>
+                    </next>
+                  </block>
+                </statement>
+                <statement name="ELSE">
+                  <block type="ai_lcd_textcarvas" id="~Z3zvb/Ssar^^iirx:xv">
+                    <value name="POSA">
+                      <block type="lcd_set_position" id="9nd`]WwmH=o!#j4DuIdw">
+                        <value name="POSX">
+                          <shadow type="math_number" id="skFf3sKoo@;KX:VLXS3i">
+                            <field name="NUM">12</field>
+                          </shadow>
+                        </value>
+                        <value name="POSY">
+                          <shadow type="math_number" id="[q25Nh[I9M!D0ydd;!bY">
+                            <field name="NUM">28</field>
+                          </shadow>
+                        </value>
+                      </block>
+                    </value>
+                    <value name="CONTENT">
+                      <shadow type="text" id="Bj(v4_yu%2^X3d7UZRN+">
+                        <field name="TEXT">已成功加载numpy.random模块</field>
+                      </shadow>
+                    </value>
+                    <value name="COLOR">
+                      <block type="lcd_set_color" id="GV_lFH/kJ{]BuO[8=LDU">
+                        <field name="COLOR">#ffffff</field>
+                      </block>
+                    </value>
+                    <value name="Scale">
+                      <shadow type="math_number" id="=},tl+uieXuLP=qdfj7W">
+                        <field name="NUM">1</field>
+                      </shadow>
+                    </value>
+                    <next>
+                      <block type="ai_lcd_textcarvas" id="JqH8h;gsRc@wHB5}K17.">
+                        <value name="POSA">
+                          <block type="lcd_set_position" id="4qYD!q0KCF5R6GiSW9D{">
+                            <value name="POSX">
+                              <shadow type="math_number" id="mf8TvF2I`GoLN1,~1KaT">
+                                <field name="NUM">12</field>
                               </shadow>
                               </shadow>
                             </value>
                             </value>
-                            <value name="COLOR">
-                              <block type="lcd_set_color" id="GV_lFH/kJ{]BuO[8=LDU">
-                                <field name="COLOR">#ffffff</field>
-                              </block>
-                            </value>
-                            <value name="Scale">
-                              <shadow type="math_number" id="=},tl+uieXuLP=qdfj7W">
-                                <field name="NUM">1</field>
+                            <value name="POSY">
+                              <shadow type="math_number" id="1N7D5vd@M:aC]u-[ojm%">
+                                <field name="NUM">48</field>
                               </shadow>
                               </shadow>
                             </value>
                             </value>
+                          </block>
+                        </value>
+                        <value name="CONTENT">
+                          <shadow type="text" id=";bnp0VO5A_`,;hF$0vvi">
+                            <field name="TEXT">程序将自动退出并需要再次开启来完成配置</field>
+                          </shadow>
+                        </value>
+                        <value name="COLOR">
+                          <block type="lcd_set_color" id="a@*4YomcVT*#ehAN^uG|">
+                            <field name="COLOR">#ffffff</field>
+                          </block>
+                        </value>
+                        <value name="Scale">
+                          <shadow type="math_number" id="evgo5oJN5k[t69)#2z:J">
+                            <field name="NUM">1</field>
+                          </shadow>
+                        </value>
+                        <next>
+                          <block type="ai_lcd_showcarvas_set_display" id="nQ)W!goL:J=Q!eidra?g">
                             <next>
                             <next>
-                              <block type="ai_lcd_textcarvas" id="JqH8h;gsRc@wHB5}K17.">
-                                <field name="varitem">canvas</field>
-                                <value name="POSA">
-                                  <block type="lcd_set_position" id="4qYD!q0KCF5R6GiSW9D{">
-                                    <value name="POSX">
-                                      <shadow type="math_number" id="mf8TvF2I`GoLN1,~1KaT">
-                                        <field name="NUM">12</field>
-                                      </shadow>
-                                    </value>
-                                    <value name="POSY">
-                                      <shadow type="math_number" id="1N7D5vd@M:aC]u-[ojm%">
-                                        <field name="NUM">48</field>
-                                      </shadow>
-                                    </value>
-                                  </block>
-                                </value>
-                                <value name="CONTENT">
-                                  <shadow type="text" id=";bnp0VO5A_`,;hF$0vvi">
-                                    <field name="TEXT">程序将自动退出并需要再次开启来完成配置</field>
-                                  </shadow>
-                                </value>
-                                <value name="COLOR">
-                                  <block type="lcd_set_color" id="a@*4YomcVT*#ehAN^uG|">
-                                    <field name="COLOR">#ffffff</field>
-                                  </block>
-                                </value>
-                                <value name="Scale">
-                                  <shadow type="math_number" id="evgo5oJN5k[t69)#2z:J">
-                                    <field name="NUM">1</field>
-                                  </shadow>
-                                </value>
+                              <block type="Numpy_Neural_Network_numpy_clear" id="^KGPs1YHz(XE+Cc:ZHp#">
                                 <next>
                                 <next>
-                                  <block type="ai_lcd_showcarvas_set_display" id="nQ)W!goL:J=Q!eidra?g">
-                                    <field name="varitem">canvas</field>
+                                  <block type="time_delay" id="Dxnz7d`eoA,Mcvn9xzb/">
+                                    <value name="DELAY_TIME_MILI">
+                                      <block type="math_number" id="kE6Z4M@Ac(v7*L:hCTKR">
+                                        <field name="NUM">3000</field>
+                                      </block>
+                                    </value>
                                     <next>
                                     <next>
-                                      <block type="Numpy_Neural_Network_numpy_clear" id="^KGPs1YHz(XE+Cc:ZHp#">
-                                        <next>
-                                          <block type="time_delay" id="Dxnz7d`eoA,Mcvn9xzb/">
-                                            <value name="DELAY_TIME_MILI">
-                                              <block type="math_number" id="kE6Z4M@Ac(v7*L:hCTKR">
-                                                <field name="NUM">3000</field>
-                                              </block>
-                                            </value>
-                                            <next>
-                                              <block type="controls_flow_statements" id="9F%4+dzn_h`=Xb/9vrv.">
-                                                <field name="FLOW">BREAK</field>
-                                              </block>
-                                            </next>
-                                          </block>
-                                        </next>
+                                      <block type="controls_flow_statements" id="9F%4+dzn_h`=Xb/9vrv.">
+                                        <field name="FLOW">BREAK</field>
                                       </block>
                                       </block>
                                     </next>
                                     </next>
                                   </block>
                                   </block>
@@ -324,13 +291,13 @@
                               </block>
                               </block>
                             </next>
                             </next>
                           </block>
                           </block>
-                        </statement>
+                        </next>
                       </block>
                       </block>
-                    </statement>
+                    </next>
                   </block>
                   </block>
-                </next>
+                </statement>
               </block>
               </block>
-            </next>
+            </statement>
           </block>
           </block>
         </next>
         </next>
       </block>
       </block>

+ 27 - 226
src/python/AI/numpyMnist识别.xml

@@ -1,241 +1,42 @@
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
-  <block type="ai_camera_init" id="m,R%akgo.%94MT8!UZ+%" x="319" y="-70">
+  <block type="ai_lcd_showcarvas_set_cord" id="@IKjFN!)dQay$lDB,aW#" x="-80" y="40">
+    <value name="xy">
+      <block type="lcd_set_position" id="CBDNRCQ{QyKUsOb`~03f">
+        <value name="POSX">
+          <shadow type="math_number" id="s_%FL]-m@63}YoK6|7o~">
+            <field name="NUM">48</field>
+          </shadow>
+        </value>
+        <value name="POSY">
+          <shadow type="math_number" id="jkfhT?wq+CWr(vZ3juv^">
+            <field name="NUM">8</field>
+          </shadow>
+        </value>
+      </block>
+    </value>
     <next>
     <next>
-      <block type="ai_lcd_screeninit" id="a3n`:ur[V=sDMp[{~yxr">
-        <field name="isScreen">False</field>
+      <block type="Numpy_Neural_Network_init" id="vkZAbF*r$hiGs}4?4U3M">
         <next>
         <next>
-          <block type="ai_lcd_createnonecarvas" id="OL;T[bn[uL3N)y.h.IDP">
-            <field name="varitem">canvas</field>
-            <value name="wh">
-              <block type="lcd_set_width_height" id="|Wq!@WOA|2RKQMOeLjlK">
-                <value name="WIDTH">
-                  <shadow type="math_number" id="|RPt/PCzx1X{,Mpa1d|^">
-                    <field name="NUM">320</field>
-                  </shadow>
-                </value>
-                <value name="HEIGHT">
-                  <shadow type="math_number" id="L%*H)XLhbB7)~u83kSqG">
-                    <field name="NUM">240</field>
-                  </shadow>
-                </value>
+          <block type="Numpy_Neural_Network_numpy_loading_model" id="vg+O{|o8xca^Hzc8Cqgx">
+            <value name="class_input">
+              <block type="text" id="0Wa+eO*5Y)-Gq,Vy_tu~">
+                <field name="TEXT">/root/user/model/NN.pkl</field>
               </block>
               </block>
             </value>
             </value>
             <next>
             <next>
-              <block type="Numpy_Neural_Network_init" id="Ctim5O:0p(zs1l:P!w}I">
-                <next>
-                  <block type="Numpy_Neural_Network_numpy_loading_model" id="2buQaOr@LRfu$fS)46Yn">
-                    <value name="class_input">
-                      <block type="text" id=";vE(?!6-@i(vZIu[:`cx">
-                        <field name="TEXT">/root/user/model/NN.pkl</field>
-                      </block>
-                    </value>
+              <block type="controls_repeat_forever" id="AOR9r+DS1`:!kj?-YWfl">
+                <statement name="DO">
+                  <block type="ai_camera_fit_to_screen_size" id="!fzj=PD|L6e4Z`d+82aX">
+                    <field name="size">224</field>
                     <next>
                     <next>
-                      <block type="variables_set" id="8:QA1fitT@,u*eQlAv0)">
-                        <field name="VAR">result_numpy</field>
-                        <value name="VALUE">
-                          <shadow type="math_number" id="(;c{Yd/U?6mp4{!/*0RV">
-                            <field name="NUM">0</field>
-                          </shadow>
-                          <block type="text" id="|r|n?f/%Q2fxPR7y{0hl">
-                            <field name="TEXT"></field>
-                          </block>
-                        </value>
+                      <block type="Numpy_Neural_Network_numpy_loading_model_fun" id="3@#hcv;uW!K%RE{xzljT">
                         <next>
                         <next>
-                          <block type="controls_repeat_forever" id="?RP!;)I2o:40f-N_8)N=">
-                            <statement name="DO">
-                              <block type="variables_set" id="260Qu6eH:@lJK+Zi}l7E">
-                                <field name="VAR">canvas</field>
-                                <value name="VALUE">
-                                  <shadow type="math_number" id=",QesJn(z,97`fK*L^i[G">
-                                    <field name="NUM">0</field>
-                                  </shadow>
-                                  <block type="ai_camera_snapshot" id="-zjV,oAmD?Ij5r/Ig7[M"></block>
-                                </value>
-                                <next>
-                                  <block type="variables_set" id="xWhJIyQQip9BgzX_v^gJ">
-                                    <field name="VAR">img_numpyrecognition</field>
-                                    <value name="VALUE">
-                                      <shadow type="math_number" id=",QesJn(z,97`fK*L^i[G">
-                                        <field name="NUM">0</field>
-                                      </shadow>
-                                      <block type="v831_lcd_img_cut" id="%S8*REa?o9EFhyZ@Ux?P">
-                                        <field name="varitem">canvas</field>
-                                        <value name="xy">
-                                          <block type="ai_lcd_XY_vision" id="^6|dg?Z2~qjp?7-D|4O0">
-                                            <value name="A">
-                                              <shadow type="math_number" id="7=QQ8zHKNzP^,{?@^Sg=">
-                                                <field name="NUM">0</field>
-                                              </shadow>
-                                            </value>
-                                            <value name="B">
-                                              <shadow type="math_number" id="PnUr2Bx6.)FAi}adUST%">
-                                                <field name="NUM">0</field>
-                                              </shadow>
-                                            </value>
-                                          </block>
-                                        </value>
-                                        <value name="wh">
-                                          <block type="ai_lcd_WH_vision" id="oWx!qM,AXu2Jc.*_c8n[">
-                                            <value name="A">
-                                              <shadow type="math_number" id="ZVlFMIjJ)mAi?uzaKg9F">
-                                                <field name="NUM">224</field>
-                                              </shadow>
-                                            </value>
-                                            <value name="B">
-                                              <shadow type="math_number" id="NUzX%p,28NSOsT.~#B%#">
-                                                <field name="NUM">224</field>
-                                              </shadow>
-                                            </value>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <next>
-                                      <block type="Numpy_Neural_Network_numpy_loading_model_fun" id=";Bl@}AX)C5WP`6uAHM+X">
-                                        <field name="varitem">img_numpyrecognition</field>
-                                        <next>
-                                          <block type="variables_set" id="DiUw{mU0ej[{:.tNjlaG">
-                                            <field name="VAR">result_numpy</field>
-                                            <value name="VALUE">
-                                              <shadow type="math_number" id="(;c{Yd/U?6mp4{!/*0RV">
-                                                <field name="NUM">0</field>
-                                              </shadow>
-                                              <block type="Numpy_Neural_Network_numpy_loading_model_result" id=":!5%XCzIQ(E1B`=!wN]N"></block>
-                                            </value>
-                                            <next>
-                                              <block type="controls_if" id="Zp5XX9[RmLw3liePv#VV">
-                                                <mutation else="1"></mutation>
-                                                <value name="IF0">
-                                                  <block type="logic_compare" id="Z7Ol4`oKgl,13Wam]r!^">
-                                                    <field name="OP">NEQ</field>
-                                                    <value name="A">
-                                                      <block type="variables_get" id="y}?2P,Ln5m.W.ZxuxLAV">
-                                                        <field name="VAR">result_numpy</field>
-                                                      </block>
-                                                    </value>
-                                                    <value name="B">
-                                                      <block type="text" id="sX9C=P.:H_!sk${-1h5u">
-                                                        <field name="TEXT"></field>
-                                                      </block>
-                                                    </value>
-                                                  </block>
-                                                </value>
-                                                <statement name="DO0">
-                                                  <block type="ai_lcd_textcarvas" id="TR.XF28$150oW*1|0aHW">
-                                                    <field name="varitem">img_numpyrecognition</field>
-                                                    <value name="POSA">
-                                                      <block type="lcd_set_position" id="KAgYZ+,:+luvu9$uT.](">
-                                                        <value name="POSX">
-                                                          <shadow type="math_number" id="O5xWlMdKN1#oNWZ|{QPo">
-                                                            <field name="NUM">0</field>
-                                                          </shadow>
-                                                        </value>
-                                                        <value name="POSY">
-                                                          <shadow type="math_number" id="-0z:Wf`d*75%#Sj9Ik$:">
-                                                            <field name="NUM">0</field>
-                                                          </shadow>
-                                                        </value>
-                                                      </block>
-                                                    </value>
-                                                    <value name="CONTENT">
-                                                      <shadow type="text" id="iYJqEUeWBQ|pLA:[we;Q">
-                                                        <field name="TEXT"></field>
-                                                      </shadow>
-                                                      <block type="text_join" id="-6gg}m|47f9QfReDlFT+">
-                                                        <mutation items="1"></mutation>
-                                                        <value name="ADD0">
-                                                          <block type="variables_get" id="l)Q7ayMuJ|:J7d,GY]KL">
-                                                            <field name="VAR">result_numpy</field>
-                                                          </block>
-                                                        </value>
-                                                      </block>
-                                                    </value>
-                                                    <value name="COLOR">
-                                                      <block type="lcd_set_color" id="]1CJpM/g0*bDpQ/](*hY">
-                                                        <field name="COLOR">#cccccc</field>
-                                                      </block>
-                                                    </value>
-                                                    <value name="Scale">
-                                                      <shadow type="math_number" id="~BcWzoZ6yn)*d=%+J15[">
-                                                        <field name="NUM">3</field>
-                                                      </shadow>
-                                                    </value>
-                                                  </block>
-                                                </statement>
-                                                <statement name="ELSE">
-                                                  <block type="ai_lcd_textcarvas" id="REtdiYJPbK]db9[kYy?[">
-                                                    <field name="varitem">img_numpyrecognition</field>
-                                                    <value name="POSA">
-                                                      <block type="lcd_set_position" id=")1z%)f#NS=!G;@O,[eBJ">
-                                                        <value name="POSX">
-                                                          <shadow type="math_number" id="7$bodStcq|l|DLNwb@PI">
-                                                            <field name="NUM">0</field>
-                                                          </shadow>
-                                                        </value>
-                                                        <value name="POSY">
-                                                          <shadow type="math_number" id="ahXPS/s?K03{yLW64y}l">
-                                                            <field name="NUM">0</field>
-                                                          </shadow>
-                                                        </value>
-                                                      </block>
-                                                    </value>
-                                                    <value name="CONTENT">
-                                                      <shadow type="text" id="iYJqEUeWBQ|pLA:[we;Q">
-                                                        <field name="TEXT">未識別到結果</field>
-                                                      </shadow>
-                                                    </value>
-                                                    <value name="COLOR">
-                                                      <block type="lcd_set_color" id="4Q*Ua%+)SBz7a.wxK;eM">
-                                                        <field name="COLOR">#ffffff</field>
-                                                      </block>
-                                                    </value>
-                                                    <value name="Scale">
-                                                      <shadow type="math_number" id="L,2;ZG)2Et6f5Pcd`SGL">
-                                                        <field name="NUM">2</field>
-                                                      </shadow>
-                                                    </value>
-                                                  </block>
-                                                </statement>
-                                                <next>
-                                                  <block type="ai_lcd_showcarvas_set_cord" id="g,O(4o[Up`S7T.{SCRq1">
-                                                    <field name="varitem">img_numpyrecognition</field>
-                                                    <value name="xy">
-                                                      <block type="lcd_set_position" id="_qb4?u(cb)nJ(#`nNw:j">
-                                                        <value name="POSX">
-                                                          <shadow type="math_number" id="/.P;)daaNEVo.Egl7A]d">
-                                                            <field name="NUM">48</field>
-                                                          </shadow>
-                                                        </value>
-                                                        <value name="POSY">
-                                                          <shadow type="math_number" id="D+)c2t[=4LRp9E%7~5-n">
-                                                            <field name="NUM">8</field>
-                                                          </shadow>
-                                                        </value>
-                                                      </block>
-                                                    </value>
-                                                    <next>
-                                                      <block type="ai_lcd_showcarvas_set_display" id="(V_.y}vQU~TK!D$;4SVw">
-                                                        <field name="varitem">img_numpyrecognition</field>
-                                                      </block>
-                                                    </next>
-                                                  </block>
-                                                </next>
-                                              </block>
-                                            </next>
-                                          </block>
-                                        </next>
-                                      </block>
-                                    </next>
-                                  </block>
-                                </next>
-                              </block>
-                            </statement>
-                          </block>
+                          <block type="ai_lcd_showcarvas_set_display" id="}ONfcx:G4|/n]Z?I1::W"></block>
                         </next>
                         </next>
                       </block>
                       </block>
                     </next>
                     </next>
                   </block>
                   </block>
-                </next>
+                </statement>
               </block>
               </block>
             </next>
             </next>
           </block>
           </block>

+ 25 - 93
src/python/AI/人脸检测.xml

@@ -1,105 +1,37 @@
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
-  <block type="ai_lcd_screeninit" id="C?v(YEe$x4G?o*-U1IXH" x="-203" y="-51">
-    <field name="isScreen">False</field>
-    <next>
-      <block type="ai_lcd_showcarvas_set_cord" id="b,{A.l8-p?*`CK$$L5:f">
-        <field name="varitem">img_facedetection</field>
-        <value name="xy">
-          <block type="lcd_set_position" id="j[b^)/cijT-k70S[#Sr.">
-            <value name="POSX">
-              <shadow type="math_number" id="%=b3t)QLDM;*Z_SZw!Yr">
-                <field name="NUM">48</field>
-              </shadow>
-            </value>
-            <value name="POSY">
-              <shadow type="math_number" id="_/ar(f~4ajc5ADpzHe5%">
-                <field name="NUM">8</field>
-              </shadow>
-            </value>
-          </block>
+  <block type="ai_lcd_showcarvas_set_cord" id="y@{b*WZh|fe+.miBi0+@" x="-61" y="10">
+    <value name="xy">
+      <block type="lcd_set_position" id="Dqg}xVvyGqRX0!-~lhO^">
+        <value name="POSX">
+          <shadow type="math_number" id="U2-:r]}#3|O9*Y?M%t72">
+            <field name="NUM">48</field>
+          </shadow>
+        </value>
+        <value name="POSY">
+          <shadow type="math_number" id="/3UMkRjN5ZxR9-!3YksA">
+            <field name="NUM">8</field>
+          </shadow>
         </value>
         </value>
-        <next>
-          <block type="controls_repeat_forever" id="ELs)W_Hx[X)_F~lsO7IR">
-            <statement name="DO">
-              <block type="ai_camera_fit_to_screen_size" id="HPF[p/ro.d`}dhxDSjCZ">
-                <field name="varitem">img_facedetection</field>
-                <field name="size">224</field>
+      </block>
+    </value>
+    <next>
+      <block type="controls_repeat_forever" id="G;eI?9/bLk8BCQx,uJ!a">
+        <statement name="DO">
+          <block type="ai_camera_fit_to_screen_size" id=").i8mMAB6q[8N%`SL}P3">
+            <field name="size">224</field>
+            <next>
+              <block type="ai_model_face_recognition_load" id="yG0O]?M58_OGNL}x@*c:">
                 <next>
                 <next>
-                  <block type="ai_model_face_recognition_load" id="T^aL4IO,1pn{NL?Va$^Q">
-                    <field name="varitem">img_facedetection</field>
+                  <block type="ai_model_face" id=";h6=_#sA2YQ2~xG%xfAB">
                     <next>
                     <next>
-                      <block type="controls_if" id="+XA1WIN8x{d!Qc9qx$}M">
-                        <value name="IF0">
-                          <block type="ai_model_face" id="N[eJ[[GrBuHQyDucg~IN"></block>
-                        </value>
-                        <statement name="DO0">
-                          <block type="ai_model_face_new" id="4g.8MudM6y2WollC#z|/">
-                            <statement name="input">
-                              <block type="ai_lcd_draw_rectangle" id="^8yQ7l]aXa;Yql(LQIAE">
-                                <field name="varitem">img_facedetection</field>
-                                <field name="rect_type">rect</field>
-                                <value name="POSA">
-                                  <block type="lcd_set_position" id="@d[V{Q85sdu`jJrQ76ZP" inline="false">
-                                    <value name="POSX">
-                                      <shadow type="math_number" id="_*lsf*-=F4G0*k:-g?|A">
-                                        <field name="NUM">0</field>
-                                      </shadow>
-                                      <block type="ai_model_xy" id="I0lJ$$Uu6ozcov4I($Kl">
-                                        <field name="TYPE">X</field>
-                                      </block>
-                                    </value>
-                                    <value name="POSY">
-                                      <shadow type="math_number" id="MG0c{/WZ[.H`;DTyEN~R">
-                                        <field name="NUM">0</field>
-                                      </shadow>
-                                      <block type="ai_model_xy" id="^7CkWuUG[*T0ySK.*pF;">
-                                        <field name="TYPE">Y</field>
-                                      </block>
-                                    </value>
-                                  </block>
-                                </value>
-                                <value name="POSB">
-                                  <block type="lcd_set_width_height" id="7dzFgJT%@G1O1oKsyyxw" inline="false">
-                                    <value name="WIDTH">
-                                      <shadow type="math_number" id="U$9=Clovt4Y-t4kNJ+%`">
-                                        <field name="NUM">320</field>
-                                      </shadow>
-                                      <block type="ai_model_xy" id="]?7lA]eoOd:hurcLcx,a">
-                                        <field name="TYPE">2</field>
-                                      </block>
-                                    </value>
-                                    <value name="HEIGHT">
-                                      <shadow type="math_number" id="Z|hWs;SP+0X|ZUIKe0ar">
-                                        <field name="NUM">240</field>
-                                      </shadow>
-                                      <block type="ai_model_xy" id=")g1`_3056I[or`Gv|,#z">
-                                        <field name="TYPE">3</field>
-                                      </block>
-                                    </value>
-                                  </block>
-                                </value>
-                                <value name="COLOR">
-                                  <block type="lcd_set_color" id="XMa,YV6:MyHe3;Kru88}">
-                                    <field name="COLOR">#ff0000</field>
-                                  </block>
-                                </value>
-                              </block>
-                            </statement>
-                          </block>
-                        </statement>
-                        <next>
-                          <block type="ai_lcd_showcarvas_set_display" id="JX:Wp@oAZ+Ib41=Dzk|7">
-                            <field name="varitem">img_facedetection</field>
-                          </block>
-                        </next>
-                      </block>
+                      <block type="ai_lcd_showcarvas_set_display" id="G53S9xg,q:=U=lWRg95p"></block>
                     </next>
                     </next>
                   </block>
                   </block>
                 </next>
                 </next>
               </block>
               </block>
-            </statement>
+            </next>
           </block>
           </block>
-        </next>
+        </statement>
       </block>
       </block>
     </next>
     </next>
   </block>
   </block>

+ 45 - 178
src/python/AI/人脸识别.xml

@@ -1,194 +1,61 @@
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
-  <block type="ai_lcd_screeninit" id="vsL]kHF{k5SZFY8Z!XHC" x="219" y="162">
-    <field name="isScreen">False</field>
-    <next>
-      <block type="ai_lcd_showcarvas_set_cord" id="_mY5,lZ=jFjo-}[,vs2;">
-        <field name="varitem">img_recognized_face</field>
-        <value name="xy">
-          <block type="lcd_set_position" id="zfFNxcraIWGM3~z2pKSJ">
-            <value name="POSX">
-              <shadow type="math_number" id="k2PjLa5mCQ)JS_r?Y4fL">
-                <field name="NUM">48</field>
-              </shadow>
-            </value>
-            <value name="POSY">
-              <shadow type="math_number" id="j43l8joc1(rJi.}e~@I,">
-                <field name="NUM">8</field>
-              </shadow>
-            </value>
-          </block>
+  <block type="ai_lcd_showcarvas_set_cord" id="y@{b*WZh|fe+.miBi0+@" x="162" y="135">
+    <value name="xy">
+      <block type="lcd_set_position" id="Dqg}xVvyGqRX0!-~lhO^">
+        <value name="POSX">
+          <shadow type="math_number" id="U2-:r]}#3|O9*Y?M%t72">
+            <field name="NUM">48</field>
+          </shadow>
         </value>
         </value>
-        <next>
-          <block type="controls_repeat_forever" id="k6_iO)X)*A5)x$8h~!k2">
-            <statement name="DO">
-              <block type="ai_camera_fit_to_screen_size" id="UJtA#Rxk3Z7VY{tnWw0d">
-                <field name="varitem">img_recognized_face</field>
-                <field name="size">224</field>
-                <next>
-                  <block type="face_recognition_load" id="}mE2s`WlB=PlP3SLun|:">
-                    <field name="varitem">img_recognized_face</field>
-                    <field name="people_name">people_name_list</field>
-                    <value name="class_input">
-                      <block type="lists_create_with" id="E`,h$-;d/hncq-@Z_%ba">
-                        <mutation items="3"></mutation>
-                        <value name="ADD0">
-                          <block type="text" id="E:(yI5K$@stpVHia/@B_">
-                            <field name="TEXT">Name1</field>
-                          </block>
-                        </value>
-                        <value name="ADD1">
-                          <block type="text" id="gWsD]xE@`Q:-q8s_Hx6-">
-                            <field name="TEXT">Name2</field>
-                          </block>
-                        </value>
-                        <value name="ADD2">
-                          <block type="text" id="$Ss|.R8$Pp|LcuV-O*3D">
-                            <field name="TEXT">Name3</field>
-                          </block>
-                        </value>
+        <value name="POSY">
+          <shadow type="math_number" id="/3UMkRjN5ZxR9-!3YksA">
+            <field name="NUM">8</field>
+          </shadow>
+        </value>
+      </block>
+    </value>
+    <next>
+      <block type="controls_repeat_forever" id="G;eI?9/bLk8BCQx,uJ!a">
+        <statement name="DO">
+          <block type="ai_camera_fit_to_screen_size" id=").i8mMAB6q[8N%`SL}P3">
+            <field name="size">224</field>
+            <next>
+              <block type="face_recognition_load" id="nr7fbKdQsVfEXai[_#v]">
+                <value name="class_input">
+                  <block type="lists_create_with" id="o5@ID3l.9e,?$!m||G7(">
+                    <mutation items="3"></mutation>
+                    <value name="ADD0">
+                      <block type="text" id="%b)Qd3!yFegZ{*p=r,Ke">
+                        <field name="TEXT">Name1</field>
                       </block>
                       </block>
                     </value>
                     </value>
+                    <value name="ADD1">
+                      <block type="text" id="cesu]-`^=b#E/%@]?hL8">
+                        <field name="TEXT">Name2</field>
+                      </block>
+                    </value>
+                    <value name="ADD2">
+                      <block type="text" id="UY3d%xU($qHC1BCh^eA7">
+                        <field name="TEXT">Name3</field>
+                      </block>
+                    </value>
+                  </block>
+                </value>
+                <next>
+                  <block type="face_recognition_data_load" id="47(H/I_Lx,P99}aVU5?S">
                     <next>
                     <next>
-                      <block type="face_recognition_data_load" id="DdQ-gXXF7B/-b);XHrU|">
+                      <block type="face_recognition_if_face" id="mD.,N+8B%47fGAZ*hd2G">
                         <next>
                         <next>
-                          <block type="controls_if" id="jyM|OMb9X,cM+/{=o;P%">
-                            <value name="IF0">
-                              <block type="face_recognition_if_face" id="~hQ=hMY#C(D(:?4}fQ8="></block>
-                            </value>
-                            <statement name="DO0">
-                              <block type="face_recognition_if_face_new" id="Q|/z?*,r[!^4)oC^|?dw">
-                                <statement name="input">
-                                  <block type="ai_lcd_draw_rectangle" id="lb7l2oX3OfU6ztnC{_6r">
-                                    <field name="varitem">img_recognized_face</field>
-                                    <field name="rect_type">rect</field>
-                                    <value name="POSA">
-                                      <block type="lcd_set_position" id="mts:M__%ncAqgE0B0LMZ">
-                                        <value name="POSX">
-                                          <shadow type="math_number" id="iW,OB/)OV;x8e1FP6!W:">
-                                            <field name="NUM">0</field>
-                                          </shadow>
-                                          <block type="face_recognition_detection_rectangle" id="[1h9q3Ll.+BQ4_Pcpq{B">
-                                            <field name="TYPE">X</field>
-                                          </block>
-                                        </value>
-                                        <value name="POSY">
-                                          <shadow type="math_number" id="*$gu9/4r2.LLUm6|Mu5N">
-                                            <field name="NUM">0</field>
-                                          </shadow>
-                                          <block type="face_recognition_detection_rectangle" id="wW4UxZ!#w;=IUUgOSJiA">
-                                            <field name="TYPE">Y</field>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="POSB">
-                                      <block type="lcd_set_width_height" id="A{Y3(s($gujW((pa4`L|">
-                                        <value name="WIDTH">
-                                          <shadow type="math_number" id="_5lNjl2Y4$aw`PL/l^?v">
-                                            <field name="NUM">320</field>
-                                          </shadow>
-                                          <block type="face_recognition_detection_rectangle" id="5gouD;#H7hKiDo0pJ|nw">
-                                            <field name="TYPE">2</field>
-                                          </block>
-                                        </value>
-                                        <value name="HEIGHT">
-                                          <shadow type="math_number" id="gvN+![xzGHRLILIU+}ce">
-                                            <field name="NUM">240</field>
-                                          </shadow>
-                                          <block type="face_recognition_detection_rectangle" id="Cbb{.}T%5JxT7AiOZX^D">
-                                            <field name="TYPE">3</field>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="COLOR">
-                                      <block type="lcd_set_color" id="{v|yh8uGP?`0sR86.E`@">
-                                        <field name="COLOR">#33cc00</field>
-                                      </block>
-                                    </value>
-                                    <next>
-                                      <block type="ai_lcd_textcarvas" id="Yg{LD4v9P*}08r~RdojQ">
-                                        <field name="varitem">img_recognized_face</field>
-                                        <value name="POSA">
-                                          <block type="lcd_set_position" id="LPlT$dUA(1x)``kKM/Uz">
-                                            <value name="POSX">
-                                              <shadow type="math_number" id="Fdr}7U`TTwbw+Y~p{|jW">
-                                                <field name="NUM">40</field>
-                                              </shadow>
-                                            </value>
-                                            <value name="POSY">
-                                              <shadow type="math_number" id="Q)![)yX*qw3dJDvjNK(`">
-                                                <field name="NUM">0</field>
-                                              </shadow>
-                                            </value>
-                                          </block>
-                                        </value>
-                                        <value name="CONTENT">
-                                          <shadow type="text" id="9u]b*4uMFsb]{zt_o0-h">
-                                            <field name="TEXT"></field>
-                                          </shadow>
-                                          <block type="text_join" id="X%sX04w$ee|_uk`Jx;l0">
-                                            <mutation items="3"></mutation>
-                                            <value name="ADD0">
-                                              <block type="face_recognition_detection_rectangle" id="kG5/_bwes4eSvvWxXHp|">
-                                                <field name="TYPE">0</field>
-                                              </block>
-                                            </value>
-                                            <value name="ADD1">
-                                              <block type="text" id="lpXm{]Wop8.gq8H-Ps}{">
-                                                <field name="TEXT"> : </field>
-                                              </block>
-                                            </value>
-                                            <value name="ADD2">
-                                              <block type="math_keep_decimal" id="^e4_!zD+]MQ|(x9IFr1j">
-                                                <value name="NUM">
-                                                  <shadow type="math_number" id="MkDC]hiFpjZK:`Gk%LgV">
-                                                    <field name="NUM">3.1415926</field>
-                                                  </shadow>
-                                                  <block type="face_recognition_detection_rectangle" id="n:ohhK0[l3FJ9FeV/4E0">
-                                                    <field name="TYPE">1</field>
-                                                  </block>
-                                                </value>
-                                                <value name="PLACE">
-                                                  <shadow type="math_number" id="5.b|EieLi+b[P}|7jU$#">
-                                                    <field name="NUM">2</field>
-                                                  </shadow>
-                                                </value>
-                                              </block>
-                                            </value>
-                                          </block>
-                                        </value>
-                                        <value name="COLOR">
-                                          <block type="lcd_set_color" id="IhXpC6h~ChgQN:%(.HXE">
-                                            <field name="COLOR">#33cc00</field>
-                                          </block>
-                                        </value>
-                                        <value name="Scale">
-                                          <shadow type="math_number" id="dI,3mCWvpT+v8w/HDVd4">
-                                            <field name="NUM">1</field>
-                                          </shadow>
-                                        </value>
-                                      </block>
-                                    </next>
-                                  </block>
-                                </statement>
-                              </block>
-                            </statement>
-                            <next>
-                              <block type="ai_lcd_showcarvas_set_display" id="pw(}O#aG,B}p+dSjkc^*">
-                                <field name="varitem">img_recognized_face</field>
-                              </block>
-                            </next>
-                          </block>
+                          <block type="ai_lcd_showcarvas_set_display" id="G53S9xg,q:=U=lWRg95p"></block>
                         </next>
                         </next>
                       </block>
                       </block>
                     </next>
                     </next>
                   </block>
                   </block>
                 </next>
                 </next>
               </block>
               </block>
-            </statement>
+            </next>
           </block>
           </block>
-        </next>
+        </statement>
       </block>
       </block>
     </next>
     </next>
   </block>
   </block>

+ 52 - 184
src/python/AI/人脸采集.xml

@@ -1,193 +1,61 @@
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
-  <block type="ai_lcd_screeninit" id="vsL]kHF{k5SZFY8Z!XHC" x="219" y="162">
-    <field name="isScreen">False</field>
-    <next>
-      <block type="ai_lcd_showcarvas_set_cord" id="_mY5,lZ=jFjo-}[,vs2;">
-        <field name="varitem">img_recognized_face</field>
-        <value name="xy">
-          <block type="lcd_set_position" id="zfFNxcraIWGM3~z2pKSJ">
-            <value name="POSX">
-              <shadow type="math_number" id="k2PjLa5mCQ)JS_r?Y4fL">
-                <field name="NUM">48</field>
-              </shadow>
-            </value>
-            <value name="POSY">
-              <shadow type="math_number" id="j43l8joc1(rJi.}e~@I,">
-                <field name="NUM">8</field>
-              </shadow>
-            </value>
-          </block>
+  <block type="ai_lcd_showcarvas_set_cord" id="y@{b*WZh|fe+.miBi0+@" x="162" y="135">
+    <value name="xy">
+      <block type="lcd_set_position" id="Dqg}xVvyGqRX0!-~lhO^">
+        <value name="POSX">
+          <shadow type="math_number" id="U2-:r]}#3|O9*Y?M%t72">
+            <field name="NUM">48</field>
+          </shadow>
         </value>
         </value>
-        <next>
-          <block type="controls_repeat_forever" id="k6_iO)X)*A5)x$8h~!k2">
-            <statement name="DO">
-              <block type="ai_camera_fit_to_screen_size" id="UJtA#Rxk3Z7VY{tnWw0d">
-                <field name="varitem">img_recognized_face</field>
-                <field name="size">224</field>
-                <next>
-                  <block type="face_recognition_load" id="}mE2s`WlB=PlP3SLun|:">
-                    <field name="varitem">img_recognized_face</field>
-                    <field name="people_name">people_name_list</field>
-                    <value name="class_input">
-                      <block type="lists_create_with" id="E`,h$-;d/hncq-@Z_%ba">
-                        <mutation items="3"></mutation>
-                        <value name="ADD0">
-                          <block type="text" id="E:(yI5K$@stpVHia/@B_">
-                            <field name="TEXT">Name1</field>
-                          </block>
-                        </value>
-                        <value name="ADD1">
-                          <block type="text" id="gWsD]xE@`Q:-q8s_Hx6-">
-                            <field name="TEXT">Name2</field>
-                          </block>
-                        </value>
-                        <value name="ADD2">
-                          <block type="text" id="$Ss|.R8$Pp|LcuV-O*3D">
-                            <field name="TEXT">Name3</field>
-                          </block>
-                        </value>
+        <value name="POSY">
+          <shadow type="math_number" id="/3UMkRjN5ZxR9-!3YksA">
+            <field name="NUM">8</field>
+          </shadow>
+        </value>
+      </block>
+    </value>
+    <next>
+      <block type="controls_repeat_forever" id="G;eI?9/bLk8BCQx,uJ!a">
+        <statement name="DO">
+          <block type="ai_camera_fit_to_screen_size" id=").i8mMAB6q[8N%`SL}P3">
+            <field name="size">224</field>
+            <next>
+              <block type="face_recognition_load" id="nr7fbKdQsVfEXai[_#v]">
+                <value name="class_input">
+                  <block type="lists_create_with" id="o5@ID3l.9e,?$!m||G7(">
+                    <mutation items="3"></mutation>
+                    <value name="ADD0">
+                      <block type="text" id="%b)Qd3!yFegZ{*p=r,Ke">
+                        <field name="TEXT">Name1</field>
+                      </block>
+                    </value>
+                    <value name="ADD1">
+                      <block type="text" id="cesu]-`^=b#E/%@]?hL8">
+                        <field name="TEXT">Name2</field>
                       </block>
                       </block>
                     </value>
                     </value>
+                    <value name="ADD2">
+                      <block type="text" id="UY3d%xU($qHC1BCh^eA7">
+                        <field name="TEXT">Name3</field>
+                      </block>
+                    </value>
+                  </block>
+                </value>
+                <next>
+                  <block type="face_recognition_if_face" id="mD.,N+8B%47fGAZ*hd2G">
                     <next>
                     <next>
-                      <block type="controls_if" id="jyM|OMb9X,cM+/{=o;P%">
-                        <value name="IF0">
-                          <block type="face_recognition_if_face" id="~hQ=hMY#C(D(:?4}fQ8="></block>
-                        </value>
-                        <statement name="DO0">
-                          <block type="face_recognition_if_face_new" id="Q|/z?*,r[!^4)oC^|?dw">
-                            <statement name="input">
-                              <block type="face_recognition_map_face" id="!9w8erMDh?#-~90FU3GF">
-                                <field name="varitem">img_recognized_face</field>
-                                <next>
-                                  <block type="ai_lcd_draw_rectangle" id="L#ipN_oR^cP**#%)[22V">
-                                    <field name="varitem">img_recognized_face</field>
-                                    <field name="rect_type">rect</field>
-                                    <value name="POSA">
-                                      <block type="lcd_set_position" id="H`$2f0E0b7cLf#0;V(*r" inline="false">
-                                        <value name="POSX">
-                                          <shadow type="math_number" id="Zw^v!.vgJEO*5e)Z$@ez">
-                                            <field name="NUM">0</field>
-                                          </shadow>
-                                          <block type="face_recognition_detection_rectangle" id="5:ccS(*5=WWyZ#u9ub`E">
-                                            <field name="TYPE">X</field>
-                                          </block>
-                                        </value>
-                                        <value name="POSY">
-                                          <shadow type="math_number" id="L%;-y8xvNWz74)(td^lA">
-                                            <field name="NUM">0</field>
-                                          </shadow>
-                                          <block type="face_recognition_detection_rectangle" id="ja/5]4!U^bfu!+9vfmDu">
-                                            <field name="TYPE">Y</field>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="POSB">
-                                      <block type="lcd_set_width_height" id="K){jD@d/YH!Zrs6,v,6?" inline="false">
-                                        <value name="WIDTH">
-                                          <shadow type="math_number" id="ze_PBIIMv9WGutHY@g5D">
-                                            <field name="NUM">320</field>
-                                          </shadow>
-                                          <block type="face_recognition_detection_rectangle" id="rJu3=-Cw(l2?R6XL$$WP">
-                                            <field name="TYPE">2</field>
-                                          </block>
-                                        </value>
-                                        <value name="HEIGHT">
-                                          <shadow type="math_number" id="Y6H|v6Z:qeEy}}:vV|u}">
-                                            <field name="NUM">240</field>
-                                          </shadow>
-                                          <block type="face_recognition_detection_rectangle" id="+@detXc$W@25-B*RN[0t">
-                                            <field name="TYPE">3</field>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="COLOR">
-                                      <block type="lcd_set_color" id="5/ttEl{tnzn=N3nG0@yF">
-                                        <field name="COLOR">#ff0000</field>
-                                      </block>
-                                    </value>
-                                    <next>
-                                      <block type="ai_v831_button_read_released" id="~b*PdOF`@CgEjR)_Q(]3">
-                                        <field name="button_type">C</field>
-                                        <statement name="input">
-                                          <block type="face_recognition_add" id="U8^9pHjA1VGh`5euK]0t">
-                                            <next>
-                                              <block type="ai_lcd_textcarvas" id="I^D:~oT1S2SZ:o^9202+">
-                                                <field name="varitem">img_recognized_face</field>
-                                                <value name="POSA">
-                                                  <block type="lcd_set_position" id="`KOQ%Jem,Rzg89O3=@x@">
-                                                    <value name="POSX">
-                                                      <shadow type="math_number" id="9n086JO.i-fRNWjy~Aji">
-                                                        <field name="NUM">0</field>
-                                                      </shadow>
-                                                    </value>
-                                                    <value name="POSY">
-                                                      <shadow type="math_number" id="bReAuWO-1W9d=px3Tbz9">
-                                                        <field name="NUM">0</field>
-                                                      </shadow>
-                                                    </value>
-                                                  </block>
-                                                </value>
-                                                <value name="CONTENT">
-                                                  <shadow type="text" id="WSa_z844gf@?tDY`xQn?">
-                                                    <field name="TEXT">人脸已保存</field>
-                                                  </shadow>
-                                                  <block type="text_append_text" id="qPTtYKAUp:%L+#]%NMMc">
-                                                    <value name="text_abc">
-                                                      <shadow type="text" id="QxaLy%vK+KMD0h5^*U5D">
-                                                        <field name="TEXT">保存人脸</field>
-                                                      </shadow>
-                                                    </value>
-                                                    <value name="append_text">
-                                                      <shadow type="text" id=".i$/(/9|5%S])$rj=yq3">
-                                                        <field name="TEXT">def</field>
-                                                      </shadow>
-                                                      <block type="variables_get" id="-yX?;_p9Tw4?u{7Toae8">
-                                                        <field name="VAR">NUMBERPERSON</field>
-                                                      </block>
-                                                    </value>
-                                                  </block>
-                                                </value>
-                                                <value name="COLOR">
-                                                  <block type="lcd_set_color" id="jv8Y%!qP$X}^W_MF!HJc">
-                                                    <field name="COLOR">#33cc00</field>
-                                                  </block>
-                                                </value>
-                                                <value name="Scale">
-                                                  <shadow type="math_number" id="x]jP5xlz}6S]B.:pM7?1">
-                                                    <field name="NUM">1</field>
-                                                  </shadow>
-                                                </value>
-                                                <next>
-                                                  <block type="ai_lcd_showcarvas_set_display" id="jI#SSyF:0TB~;v_vM}uh">
-                                                    <field name="varitem">img_recognized_face</field>
-                                                    <next>
-                                                      <block type="time_delay" id="v}yy8/~fsY7Dt~^y*5]8">
-                                                        <value name="DELAY_TIME_MILI">
-                                                          <block type="math_number" id="A~ODUg/6N))@7i:0BBEk">
-                                                            <field name="NUM">1000</field>
-                                                          </block>
-                                                        </value>
-                                                      </block>
-                                                    </next>
-                                                  </block>
-                                                </next>
-                                              </block>
-                                            </next>
-                                          </block>
-                                        </statement>
-                                      </block>
-                                    </next>
-                                  </block>
-                                </next>
-                              </block>
-                            </statement>
+                      <block type="face_recognition_if_face_new" id="SYI?4X^`j+~-_EAgN*}w">
+                        <statement name="input">
+                          <block type="face_recognition_add" id="0c=C]fvgb6afQL$a_(7?">
+                            <field name="button_type">C</field>
                           </block>
                           </block>
                         </statement>
                         </statement>
                         <next>
                         <next>
-                          <block type="ai_lcd_showcarvas_set_display" id="pw(}O#aG,B}p+dSjkc^*">
-                            <field name="varitem">img_recognized_face</field>
+                          <block type="face_recognition_remove" id="3S^9Ef//y*qxWsp;JY`%">
+                            <field name="button_type">D</field>
+                            <next>
+                              <block type="ai_lcd_showcarvas_set_display" id="G53S9xg,q:=U=lWRg95p"></block>
+                            </next>
                           </block>
                           </block>
                         </next>
                         </next>
                       </block>
                       </block>
@@ -195,9 +63,9 @@
                   </block>
                   </block>
                 </next>
                 </next>
               </block>
               </block>
-            </statement>
+            </next>
           </block>
           </block>
-        </next>
+        </statement>
       </block>
       </block>
     </next>
     </next>
   </block>
   </block>

+ 82 - 59
src/python/AI/图片边缘检测.xml

@@ -1,90 +1,113 @@
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
-  <block type="ai_lcd_screeninit" id="C?v(YEe$x4G?o*-U1IXH" x="-80" y="284">
+  <block type="ai_lcd_screeninit" id="?n*hCVqW[E]Doc^RK-N9" x="185" y="235">
     <field name="isScreen">False</field>
     <field name="isScreen">False</field>
     <next>
     <next>
-      <block type="ai_lcd_showcarvas_set_cord" id="W7R|_~W5MK*6(A1*ncx(">
-        <field name="varitem">canvas</field>
-        <value name="xy">
-          <block type="lcd_set_position" id="V@33YjROc@9OWD#E9cB5">
-            <value name="POSX">
-              <shadow type="math_number" id=";5SG63c|BdKrCug!r@5$">
-                <field name="NUM">48</field>
-              </shadow>
-            </value>
-            <value name="POSY">
-              <shadow type="math_number" id="bA%|Dbq3+v?B(b5ikaLE">
-                <field name="NUM">8</field>
-              </shadow>
-            </value>
-          </block>
-        </value>
+      <block type="ai_model_edge_init" id="Md_9(q!d:9#-?IN^N)[J">
         <next>
         <next>
-          <block type="controls_repeat_forever" id="w-?2s^`xT,GQ0)%06pK%">
-            <statement name="DO">
-              <block type="variables_set" id="`Wz`[J^2gzR-8fT|H0be">
-                <field name="VAR">img_edgedetection</field>
-                <value name="VALUE">
-                  <shadow type="math_number" id="W2nsGH,CDw%kMx,u2*~a">
-                    <field name="NUM">0</field>
+          <block type="ai_lcd_createnonecarvas" id="|zL$]:Ll3RdOeCyU{fV2">
+            <field name="varitem">canvas</field>
+            <value name="wh">
+              <block type="lcd_set_width_height" id="tXC8B^zQ@3:eG}`:]zUM">
+                <value name="WIDTH">
+                  <shadow type="math_number" id="pFPR]I-)QlK*Hf^(~5dn">
+                    <field name="NUM">240</field>
+                  </shadow>
+                </value>
+                <value name="HEIGHT">
+                  <shadow type="math_number" id="L``hh^mCO!3_Xc-8*Lf{">
+                    <field name="NUM">320</field>
                   </shadow>
                   </shadow>
-                  <block type="v831_img_open" id="ZLR[.A$oepsRqaKb;u=^">
-                    <value name="save_path">
-                      <shadow type="text" id="08qI*1Fp2e!Bb;6]I1`J">
-                        <field name="TEXT">/root/preset/img/cocorobo_logo.jpg</field>
+                </value>
+              </block>
+            </value>
+            <next>
+              <block type="ai_lcd_showcarvas_set_cord" id="W7R|_~W5MK*6(A1*ncx(">
+                <field name="varitem">canvas</field>
+                <value name="xy">
+                  <block type="lcd_set_position" id="V@33YjROc@9OWD#E9cB5">
+                    <value name="POSX">
+                      <shadow type="math_number" id=";5SG63c|BdKrCug!r@5$">
+                        <field name="NUM">48</field>
+                      </shadow>
+                    </value>
+                    <value name="POSY">
+                      <shadow type="math_number" id="bA%|Dbq3+v?B(b5ikaLE">
+                        <field name="NUM">8</field>
                       </shadow>
                       </shadow>
                     </value>
                     </value>
                   </block>
                   </block>
                 </value>
                 </value>
                 <next>
                 <next>
-                  <block type="variables_set" id="KW22QfJ-~|(G@kPw-?b$">
-                    <field name="VAR">img_edgedetection</field>
-                    <value name="VALUE">
-                      <shadow type="math_number" id=")K7f%kP6KVqnb`}-]AYH">
-                        <field name="NUM">0</field>
-                      </shadow>
-                      <block type="v831_lcd_resizecanvas" id="_=o),xai(t0a;b]|Vze!">
-                        <field name="varitem">img_edgedetection</field>
-                        <value name="wh">
-                          <block type="ai_lcd_WH_vision" id="WhK_DsXpW8jmq!nv_ONO">
-                            <value name="A">
-                              <shadow type="math_number" id="SjUReuK0Pzt4FTOK[:SN">
-                                <field name="NUM">224</field>
-                              </shadow>
-                            </value>
-                            <value name="B">
-                              <shadow type="math_number" id="0U/vv|`A|r=DkZ_Lo5d+">
-                                <field name="NUM">224</field>
+                  <block type="controls_repeat_forever" id="w-?2s^`xT,GQ0)%06pK%">
+                    <statement name="DO">
+                      <block type="variables_set" id="`Wz`[J^2gzR-8fT|H0be">
+                        <field name="VAR">img_edgedetection</field>
+                        <value name="VALUE">
+                          <shadow type="math_number" id="W2nsGH,CDw%kMx,u2*~a">
+                            <field name="NUM">0</field>
+                          </shadow>
+                          <block type="v831_img_open" id="ZLR[.A$oepsRqaKb;u=^">
+                            <value name="save_path">
+                              <shadow type="text" id="08qI*1Fp2e!Bb;6]I1`J">
+                                <field name="TEXT">/root/preset/img/cocorobo_logo.jpg</field>
                               </shadow>
                               </shadow>
                             </value>
                             </value>
                           </block>
                           </block>
                         </value>
                         </value>
-                      </block>
-                    </value>
-                    <next>
-                      <block type="ai_model_edge_loading" id="?i4iX/KRI:lv4u:Bt0y+">
-                        <field name="varitem">img_edgedetection</field>
                         <next>
                         <next>
-                          <block type="variables_set" id="A7r9ji^*K7vk.kKIs7s9">
-                            <field name="VAR">canvas</field>
+                          <block type="variables_set" id="KW22QfJ-~|(G@kPw-?b$">
+                            <field name="VAR">img_edgedetection</field>
                             <value name="VALUE">
                             <value name="VALUE">
-                              <shadow type="math_number" id="})6gZKFCo*++!8EfwV5K">
+                              <shadow type="math_number" id=")K7f%kP6KVqnb`}-]AYH">
                                 <field name="NUM">0</field>
                                 <field name="NUM">0</field>
                               </shadow>
                               </shadow>
-                              <block type="ai_model_edge_result" id="j9t@GbN#z|)Y%^f%-1a8"></block>
+                              <block type="v831_lcd_resizecanvas" id="_=o),xai(t0a;b]|Vze!">
+                                <field name="varitem">img_edgedetection</field>
+                                <value name="wh">
+                                  <block type="ai_lcd_WH_vision" id="WhK_DsXpW8jmq!nv_ONO">
+                                    <value name="A">
+                                      <shadow type="math_number" id="SjUReuK0Pzt4FTOK[:SN">
+                                        <field name="NUM">224</field>
+                                      </shadow>
+                                    </value>
+                                    <value name="B">
+                                      <shadow type="math_number" id="0U/vv|`A|r=DkZ_Lo5d+">
+                                        <field name="NUM">224</field>
+                                      </shadow>
+                                    </value>
+                                  </block>
+                                </value>
+                              </block>
                             </value>
                             </value>
                             <next>
                             <next>
-                              <block type="ai_lcd_showcarvas_set_display" id="4qp70MjO0_xvqUa1nl3I">
-                                <field name="varitem">canvas</field>
+                              <block type="ai_model_edge_loading" id="?i4iX/KRI:lv4u:Bt0y+">
+                                <field name="varitem">img_edgedetection</field>
+                                <next>
+                                  <block type="variables_set" id="A7r9ji^*K7vk.kKIs7s9">
+                                    <field name="VAR">canvas</field>
+                                    <value name="VALUE">
+                                      <shadow type="math_number" id="})6gZKFCo*++!8EfwV5K">
+                                        <field name="NUM">0</field>
+                                      </shadow>
+                                      <block type="ai_model_edge_result" id="j9t@GbN#z|)Y%^f%-1a8"></block>
+                                    </value>
+                                    <next>
+                                      <block type="ai_lcd_showcarvas_set_display" id="4qp70MjO0_xvqUa1nl3I">
+                                        <field name="varitem">canvas</field>
+                                      </block>
+                                    </next>
+                                  </block>
+                                </next>
                               </block>
                               </block>
                             </next>
                             </next>
                           </block>
                           </block>
                         </next>
                         </next>
                       </block>
                       </block>
-                    </next>
+                    </statement>
                   </block>
                   </block>
                 </next>
                 </next>
               </block>
               </block>
-            </statement>
+            </next>
           </block>
           </block>
         </next>
         </next>
       </block>
       </block>

+ 110 - 37
src/python/AI/实时边缘检测.xml

@@ -1,52 +1,125 @@
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
-  <block type="ai_lcd_screeninit" id="C?v(YEe$x4G?o*-U1IXH" x="0" y="55">
-    <field name="isScreen">False</field>
+  <block type="ai_camera_init" id="=2S[_-0$aerx`JRmIHdZ" x="-84" y="163">
     <next>
     <next>
-      <block type="ai_lcd_showcarvas_set_cord" id="Dr`!c_d)K0s:bdT^ZZNM">
-        <field name="varitem">canvas</field>
-        <value name="xy">
-          <block type="lcd_set_position" id="9L|6p)5v{J5#wZ9Rvv4+">
-            <value name="POSX">
-              <shadow type="math_number" id=".z.%V4q-PEj-Ii)72XGr">
-                <field name="NUM">48</field>
-              </shadow>
-            </value>
-            <value name="POSY">
-              <shadow type="math_number" id="UxzN+_GI5rhlGRC~Gl`X">
-                <field name="NUM">8</field>
-              </shadow>
-            </value>
-          </block>
-        </value>
+      <block type="ai_lcd_screeninit" id="?n*hCVqW[E]Doc^RK-N9">
+        <field name="isScreen">False</field>
         <next>
         <next>
-          <block type="controls_repeat_forever" id="w-?2s^`xT,GQ0)%06pK%">
-            <statement name="DO">
-              <block type="ai_camera_fit_to_screen_size" id="m`im`q@MGN[3o39tm4+i">
-                <field name="varitem">img_edgedetection</field>
-                <field name="size">224</field>
+          <block type="ai_model_edge_init" id="Md_9(q!d:9#-?IN^N)[J">
+            <next>
+              <block type="ai_lcd_createnonecarvas" id="|zL$]:Ll3RdOeCyU{fV2">
+                <field name="varitem">canvas</field>
+                <value name="wh">
+                  <block type="lcd_set_width_height" id="tXC8B^zQ@3:eG}`:]zUM">
+                    <value name="WIDTH">
+                      <shadow type="math_number" id="pFPR]I-)QlK*Hf^(~5dn">
+                        <field name="NUM">320</field>
+                      </shadow>
+                    </value>
+                    <value name="HEIGHT">
+                      <shadow type="math_number" id="L``hh^mCO!3_Xc-8*Lf{">
+                        <field name="NUM">240</field>
+                      </shadow>
+                    </value>
+                  </block>
+                </value>
                 <next>
                 <next>
-                  <block type="ai_model_edge_loading" id="?i4iX/KRI:lv4u:Bt0y+">
-                    <field name="varitem">img_edgedetection</field>
-                    <next>
-                      <block type="variables_set" id="A7r9ji^*K7vk.kKIs7s9">
-                        <field name="VAR">canvas</field>
-                        <value name="VALUE">
-                          <shadow type="math_number" id="})6gZKFCo*++!8EfwV5K">
-                            <field name="NUM">0</field>
+                  <block type="ai_lcd_showcarvas_set_cord" id="Dr`!c_d)K0s:bdT^ZZNM">
+                    <field name="varitem">canvas</field>
+                    <value name="xy">
+                      <block type="lcd_set_position" id="9L|6p)5v{J5#wZ9Rvv4+">
+                        <value name="POSX">
+                          <shadow type="math_number" id=".z.%V4q-PEj-Ii)72XGr">
+                            <field name="NUM">48</field>
                           </shadow>
                           </shadow>
-                          <block type="ai_model_edge_result" id="j9t@GbN#z|)Y%^f%-1a8"></block>
                         </value>
                         </value>
-                        <next>
-                          <block type="ai_lcd_showcarvas_set_display" id="4qp70MjO0_xvqUa1nl3I">
-                            <field name="varitem">canvas</field>
+                        <value name="POSY">
+                          <shadow type="math_number" id="UxzN+_GI5rhlGRC~Gl`X">
+                            <field name="NUM">8</field>
+                          </shadow>
+                        </value>
+                      </block>
+                    </value>
+                    <next>
+                      <block type="controls_repeat_forever" id="w-?2s^`xT,GQ0)%06pK%">
+                        <statement name="DO">
+                          <block type="variables_set" id="`Wz`[J^2gzR-8fT|H0be">
+                            <field name="VAR">img_edgedetection</field>
+                            <value name="VALUE">
+                              <shadow type="math_number" id="W2nsGH,CDw%kMx,u2*~a">
+                                <field name="NUM">0</field>
+                              </shadow>
+                              <block type="ai_camera_snapshot" id="DBa9xDm=a.#3]gf5m845"></block>
+                            </value>
+                            <next>
+                              <block type="variables_set" id="09KmNjHueIs##7XD^ALx">
+                                <field name="VAR">img_edgedetection</field>
+                                <value name="VALUE">
+                                  <shadow type="math_number" id="){F/9|N@9m#y)pd,!b,_">
+                                    <field name="NUM">0</field>
+                                  </shadow>
+                                  <block type="v831_lcd_img_cut" id="J+p_RSyo2jg}rgd)gE1E">
+                                    <field name="varitem">img_edgedetection</field>
+                                    <value name="xy">
+                                      <block type="ai_lcd_XY_vision" id="fK@Ef2.ke7w0UG,(j9pX">
+                                        <value name="A">
+                                          <shadow type="math_number" id="%hahI,,te-Fq8V|E7+fO">
+                                            <field name="NUM">0</field>
+                                          </shadow>
+                                        </value>
+                                        <value name="B">
+                                          <shadow type="math_number" id="}WO2@xdxN+~JY-d^Z=/q">
+                                            <field name="NUM">0</field>
+                                          </shadow>
+                                        </value>
+                                      </block>
+                                    </value>
+                                    <value name="wh">
+                                      <block type="ai_lcd_WH_vision" id="mt|4#Z*uW3n6pZ1Cj%Cw">
+                                        <value name="A">
+                                          <shadow type="math_number" id="-wS3d?/N1KoQaNm;l[xx">
+                                            <field name="NUM">224</field>
+                                          </shadow>
+                                        </value>
+                                        <value name="B">
+                                          <shadow type="math_number" id=":dtuxYrzYXbLTD~nw!Or">
+                                            <field name="NUM">224</field>
+                                          </shadow>
+                                        </value>
+                                      </block>
+                                    </value>
+                                  </block>
+                                </value>
+                                <next>
+                                  <block type="ai_model_edge_loading" id="?i4iX/KRI:lv4u:Bt0y+">
+                                    <field name="varitem">img_edgedetection</field>
+                                    <next>
+                                      <block type="variables_set" id="A7r9ji^*K7vk.kKIs7s9">
+                                        <field name="VAR">canvas</field>
+                                        <value name="VALUE">
+                                          <shadow type="math_number" id="})6gZKFCo*++!8EfwV5K">
+                                            <field name="NUM">0</field>
+                                          </shadow>
+                                          <block type="ai_model_edge_result" id="j9t@GbN#z|)Y%^f%-1a8"></block>
+                                        </value>
+                                        <next>
+                                          <block type="ai_lcd_showcarvas_set_display" id="4qp70MjO0_xvqUa1nl3I">
+                                            <field name="varitem">canvas</field>
+                                          </block>
+                                        </next>
+                                      </block>
+                                    </next>
+                                  </block>
+                                </next>
+                              </block>
+                            </next>
                           </block>
                           </block>
-                        </next>
+                        </statement>
                       </block>
                       </block>
                     </next>
                     </next>
                   </block>
                   </block>
                 </next>
                 </next>
               </block>
               </block>
-            </statement>
+            </next>
           </block>
           </block>
         </next>
         </next>
       </block>
       </block>

+ 8 - 13
src/python/AI/拼音识别.xml

@@ -11,29 +11,29 @@
           <block type="set_pinyin_dict_create_with_items_insert" id="B~[y+uuI/Q0vw_u|*p+N">
           <block type="set_pinyin_dict_create_with_items_insert" id="B~[y+uuI/Q0vw_u|*p+N">
             <mutation items="2"></mutation>
             <mutation items="2"></mutation>
             <field name="KEY0">ni</field>
             <field name="KEY0">ni</field>
-            <field name="tone0">1</field>
+            <field name="toneADD00">1</field>
             <field name="KEY1">hao</field>
             <field name="KEY1">hao</field>
-            <field name="tone1">3</field>
+            <field name="toneADD11">3</field>
           </block>
           </block>
         </value>
         </value>
         <value name="PINYIN1">
         <value name="PINYIN1">
           <block type="set_pinyin_dict_create_with_items_insert" id="Mv}V~t=chVlBm0EqARVg">
           <block type="set_pinyin_dict_create_with_items_insert" id="Mv}V~t=chVlBm0EqARVg">
             <mutation items="2"></mutation>
             <mutation items="2"></mutation>
             <field name="KEY0">hao</field>
             <field name="KEY0">hao</field>
-            <field name="tone0">3</field>
+            <field name="toneADD00">3</field>
             <field name="KEY1">de</field>
             <field name="KEY1">de</field>
-            <field name="tone1">1</field>
+            <field name="toneADD11">1</field>
           </block>
           </block>
         </value>
         </value>
         <value name="PINYIN2">
         <value name="PINYIN2">
           <block type="set_pinyin_dict_create_with_items_insert" id="aLW;6^iyFA3~ICZ5)jl1">
           <block type="set_pinyin_dict_create_with_items_insert" id="aLW;6^iyFA3~ICZ5)jl1">
             <mutation items="3"></mutation>
             <mutation items="3"></mutation>
             <field name="KEY0">wan</field>
             <field name="KEY0">wan</field>
-            <field name="tone0">1</field>
+            <field name="toneADD00">1</field>
             <field name="KEY1">shang</field>
             <field name="KEY1">shang</field>
-            <field name="tone1">4</field>
+            <field name="toneADD11">4</field>
             <field name="KEY2">hao</field>
             <field name="KEY2">hao</field>
-            <field name="tone2">3</field>
+            <field name="toneADD22">1</field>
           </block>
           </block>
         </value>
         </value>
         <next>
         <next>
@@ -48,7 +48,6 @@
               <block type="controls_repeat_forever" id="0S4PQ7RZrwVxZluTFo3`">
               <block type="controls_repeat_forever" id="0S4PQ7RZrwVxZluTFo3`">
                 <statement name="DO">
                 <statement name="DO">
                   <block type="ai_lcd_clearcanvas" id="G6dP_S5Ac,*3WbL}Uo(?">
                   <block type="ai_lcd_clearcanvas" id="G6dP_S5Ac,*3WbL}Uo(?">
-                    <field name="varitem">canvas</field>
                     <next>
                     <next>
                       <block type="speech_recognition_phonetic_to_pinyin_start_recognition" id="[LP!G2AAi3Y}w(L!D`x:">
                       <block type="speech_recognition_phonetic_to_pinyin_start_recognition" id="[LP!G2AAi3Y}w(L!D`x:">
                         <next>
                         <next>
@@ -85,7 +84,6 @@
                                 </value>
                                 </value>
                                 <statement name="DO0">
                                 <statement name="DO0">
                                   <block type="ai_lcd_textcarvas" id="|i|jHK#9{to^M~/KW.lb">
                                   <block type="ai_lcd_textcarvas" id="|i|jHK#9{to^M~/KW.lb">
-                                    <field name="varitem">canvas</field>
                                     <value name="POSA">
                                     <value name="POSA">
                                       <block type="lcd_set_position" id="~4[OHfB}gvIc$f+hQf^-">
                                       <block type="lcd_set_position" id="~4[OHfB}gvIc$f+hQf^-">
                                         <value name="POSX">
                                         <value name="POSX">
@@ -122,7 +120,6 @@
                                 </statement>
                                 </statement>
                                 <statement name="ELSE">
                                 <statement name="ELSE">
                                   <block type="ai_lcd_textcarvas" id="dx20(vk6Ba%AL_$d;Cbm">
                                   <block type="ai_lcd_textcarvas" id="dx20(vk6Ba%AL_$d;Cbm">
-                                    <field name="varitem">canvas</field>
                                     <value name="POSA">
                                     <value name="POSA">
                                       <block type="lcd_set_position" id="hZZ);J-azFc,V!Kj9_x+">
                                       <block type="lcd_set_position" id="hZZ);J-azFc,V!Kj9_x+">
                                         <value name="POSX">
                                         <value name="POSX">
@@ -155,9 +152,7 @@
                                   </block>
                                   </block>
                                 </statement>
                                 </statement>
                                 <next>
                                 <next>
-                                  <block type="ai_lcd_showcarvas_set_display" id="HLzGPHV2^#sJ2veU.qwE">
-                                    <field name="varitem">canvas</field>
-                                  </block>
+                                  <block type="ai_lcd_showcarvas_set_display" id="HLzGPHV2^#sJ2veU.qwE"></block>
                                 </next>
                                 </next>
                               </block>
                               </block>
                             </next>
                             </next>

+ 25 - 164
src/python/AI/数字识别.xml

@@ -1,176 +1,37 @@
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
-  <block type="ai_lcd_screeninit" id="C?v(YEe$x4G?o*-U1IXH" x="0" y="55">
-    <field name="isScreen">False</field>
-    <next>
-      <block type="ai_lcd_showcarvas_set_cord" id="*$9j}Gn2-2h-vGozY+fV">
-        <field name="varitem">img_mnist</field>
-        <value name="xy">
-          <block type="lcd_set_position" id="P_fPE#Xqkbarnx9$[RN@">
-            <value name="POSX">
-              <shadow type="math_number" id="E.6,%Tf;Ti2CfWU7qso;">
-                <field name="NUM">48</field>
-              </shadow>
-            </value>
-            <value name="POSY">
-              <shadow type="math_number" id="3aD~ahNVR1)(X1C:ti#9">
-                <field name="NUM">8</field>
-              </shadow>
-            </value>
-          </block>
+  <block type="ai_lcd_showcarvas_set_cord" id="y@{b*WZh|fe+.miBi0+@" x="-61" y="10">
+    <value name="xy">
+      <block type="lcd_set_position" id="Dqg}xVvyGqRX0!-~lhO^">
+        <value name="POSX">
+          <shadow type="math_number" id="U2-:r]}#3|O9*Y?M%t72">
+            <field name="NUM">48</field>
+          </shadow>
+        </value>
+        <value name="POSY">
+          <shadow type="math_number" id="/3UMkRjN5ZxR9-!3YksA">
+            <field name="NUM">8</field>
+          </shadow>
         </value>
         </value>
-        <next>
-          <block type="controls_repeat_forever" id="Fivh[Zh^!Sqs0D~#`Zzk">
-            <statement name="DO">
-              <block type="ai_camera_fit_to_screen_size" id="m`im`q@MGN[3o39tm4+i">
-                <field name="varitem">img_mnist</field>
-                <field name="size">224</field>
+      </block>
+    </value>
+    <next>
+      <block type="controls_repeat_forever" id="G;eI?9/bLk8BCQx,uJ!a">
+        <statement name="DO">
+          <block type="ai_camera_fit_to_screen_size" id=").i8mMAB6q[8N%`SL}P3">
+            <field name="size">224</field>
+            <next>
+              <block type="ai_model_digital_init_loding" id="VlAG+T}#c`V@7mUg(1M$">
                 <next>
                 <next>
-                  <block type="ai_model_digital_init_loding" id="NPHSg@(HCn~H5QNy2#aW">
-                    <field name="varitem">img_mnist</field>
+                  <block type="ai_model_digital" id="A[%Ie.#+;=}SU[*h$L%X">
                     <next>
                     <next>
-                      <block type="controls_if" id="q$Uk}Ahi{E@xpcPzif%I">
-                        <value name="IF0">
-                          <block type="ai_model_digital_attribute" id="Z::)M.EI779]#TG+r(o4"></block>
-                        </value>
-                        <statement name="DO0">
-                          <block type="ai_model_digital_new" id="tR4Z}05IpY1k6%_}o.+(">
-                            <statement name="input">
-                              <block type="ai_lcd_textcarvas" id="6[-fgob}ly9@~YI}_N%M">
-                                <field name="varitem">img_mnist</field>
-                                <value name="POSA">
-                                  <block type="lcd_set_position" id="xxqARLuC11Q|t9q.U%SV">
-                                    <value name="POSX">
-                                      <shadow type="math_number" id="[*$(nkZ~_BYR+dLxLP`%">
-                                        <field name="NUM">0</field>
-                                      </shadow>
-                                    </value>
-                                    <value name="POSY">
-                                      <shadow type="math_number" id="a_H4}[ip:39Rcy}y$Em5">
-                                        <field name="NUM">0</field>
-                                      </shadow>
-                                    </value>
-                                  </block>
-                                </value>
-                                <value name="CONTENT">
-                                  <shadow type="text" id="qZ}kz{@cI8uirj~XQSKw">
-                                    <field name="TEXT"></field>
-                                  </shadow>
-                                  <block type="text_join" id="US|;CL,4qo[iKLJ$HAp_">
-                                    <mutation items="2"></mutation>
-                                    <value name="ADD0">
-                                      <block type="ai_model_digital_result" id="{L.1zuZ2U}7pi1=rLt]H">
-                                        <field name="value">c</field>
-                                      </block>
-                                    </value>
-                                    <value name="ADD1">
-                                      <block type="text_append_text" id="re1+rB73{gLC{z=.sTz;">
-                                        <value name="text_abc">
-                                          <shadow type="text" id="L-KR7mkjpE3Q;O{!#6kz">
-                                            <field name="TEXT">:</field>
-                                          </shadow>
-                                        </value>
-                                        <value name="append_text">
-                                          <shadow type="text" id="bS4+[tr0tOMklmDO8`cM">
-                                            <field name="TEXT">def</field>
-                                          </shadow>
-                                          <block type="math_keep_decimal" id="CbA*/B1X#6^~:CQdZmTT">
-                                            <value name="NUM">
-                                              <shadow type="math_number" id="]A3qBOK;`HulQk|MK|hF">
-                                                <field name="NUM">3.1415926</field>
-                                              </shadow>
-                                              <block type="ai_model_digital_result" id="B8O^K/_-{^Mx7`Kd:2G-">
-                                                <field name="value">confidence</field>
-                                              </block>
-                                            </value>
-                                            <value name="PLACE">
-                                              <shadow type="math_number" id="q.DfSA]$JJ-sd:FzubaM">
-                                                <field name="NUM">2</field>
-                                              </shadow>
-                                            </value>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                  </block>
-                                </value>
-                                <value name="COLOR">
-                                  <block type="lcd_set_color" id="PWQ1mno{^V*rw#]B?,!M">
-                                    <field name="COLOR">#ff0000</field>
-                                  </block>
-                                </value>
-                                <value name="Scale">
-                                  <shadow type="math_number" id=":{f?csD-|lLG;HEl2?oL">
-                                    <field name="NUM">1</field>
-                                  </shadow>
-                                </value>
-                                <next>
-                                  <block type="ai_lcd_draw_rectangle" id="pVB#kb|dr,+T4P{pmUxn">
-                                    <field name="varitem">img_mnist</field>
-                                    <field name="rect_type">rect</field>
-                                    <value name="POSA">
-                                      <block type="lcd_set_position" id="*ffPB=f#2$HgV6bim^;(" inline="false">
-                                        <value name="POSX">
-                                          <shadow type="math_number" id="`GJDypz:jcs[7]|!9t9i">
-                                            <field name="NUM">0</field>
-                                          </shadow>
-                                          <block type="ai_model_digital_result" id="fKl6Z}bo`#WkuZg.5jy2">
-                                            <field name="value">X</field>
-                                          </block>
-                                        </value>
-                                        <value name="POSY">
-                                          <shadow type="math_number" id="WqQv}78+U}VPKy:FD40F">
-                                            <field name="NUM">0</field>
-                                          </shadow>
-                                          <block type="ai_model_digital_result" id="ME75UG+!DDE^4M-[otp0">
-                                            <field name="value">Y</field>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="POSB">
-                                      <block type="lcd_set_width_height" id="UAVZ/Gq6fMZRIX_Vn(P+" inline="false">
-                                        <value name="WIDTH">
-                                          <shadow type="math_number" id="bIQFRSZjX=06=]fl#(EB">
-                                            <field name="NUM">320</field>
-                                          </shadow>
-                                          <block type="ai_model_digital_result" id="fC?/RAu_-n)wX/8MRHNK">
-                                            <field name="value">2</field>
-                                          </block>
-                                        </value>
-                                        <value name="HEIGHT">
-                                          <shadow type="math_number" id="]3$UnHBL=NGo|7gTr`oE">
-                                            <field name="NUM">240</field>
-                                          </shadow>
-                                          <block type="ai_model_digital_result" id="Z[.1z%dme1jonlEU!P$L">
-                                            <field name="value">3</field>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="COLOR">
-                                      <block type="lcd_set_color" id="b8ysuhgB|~U`=.2K5b/3">
-                                        <field name="COLOR">#ff0000</field>
-                                      </block>
-                                    </value>
-                                  </block>
-                                </next>
-                              </block>
-                            </statement>
-                          </block>
-                        </statement>
-                        <next>
-                          <block type="ai_lcd_showcarvas_set_display" id="=2hsbX0^[s!*Emb!W8|t">
-                            <field name="varitem">img_mnist</field>
-                          </block>
-                        </next>
-                      </block>
+                      <block type="ai_lcd_showcarvas_set_display" id="G53S9xg,q:=U=lWRg95p"></block>
                     </next>
                     </next>
                   </block>
                   </block>
                 </next>
                 </next>
               </block>
               </block>
-            </statement>
+            </next>
           </block>
           </block>
-        </next>
+        </statement>
       </block>
       </block>
     </next>
     </next>
   </block>
   </block>

+ 25 - 181
src/python/AI/物体检测.xml

@@ -1,193 +1,37 @@
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
-  <block type="ai_lcd_screeninit" id="C?v(YEe$x4G?o*-U1IXH" x="-182" y="-377">
-    <field name="isScreen">False</field>
-    <next>
-      <block type="ai_lcd_showcarvas_set_cord" id="apy;SMe!188l@{F5wG}$">
-        <field name="varitem">img_objectrecognition</field>
-        <value name="xy">
-          <block type="lcd_set_position" id="oJ8sAB_L}O2{n8+qnX_~">
-            <value name="POSX">
-              <shadow type="math_number" id="}$BAn%KsvI{p?BrP(Frm">
-                <field name="NUM">48</field>
-              </shadow>
-            </value>
-            <value name="POSY">
-              <shadow type="math_number" id="gK5d:~;2^ASi{NSwNm-V">
-                <field name="NUM">8</field>
-              </shadow>
-            </value>
-          </block>
+  <block type="ai_lcd_showcarvas_set_cord" id="y@{b*WZh|fe+.miBi0+@" x="-61" y="10">
+    <value name="xy">
+      <block type="lcd_set_position" id="Dqg}xVvyGqRX0!-~lhO^">
+        <value name="POSX">
+          <shadow type="math_number" id="U2-:r]}#3|O9*Y?M%t72">
+            <field name="NUM">48</field>
+          </shadow>
+        </value>
+        <value name="POSY">
+          <shadow type="math_number" id="/3UMkRjN5ZxR9-!3YksA">
+            <field name="NUM">8</field>
+          </shadow>
         </value>
         </value>
-        <next>
-          <block type="controls_repeat_forever" id="w-?2s^`xT,GQ0)%06pK%">
-            <statement name="DO">
-              <block type="ai_camera_fit_to_screen_size" id="m`im`q@MGN[3o39tm4+i">
-                <field name="varitem">img_objectrecognition</field>
-                <field name="size">224</field>
+      </block>
+    </value>
+    <next>
+      <block type="controls_repeat_forever" id="G;eI?9/bLk8BCQx,uJ!a">
+        <statement name="DO">
+          <block type="ai_camera_fit_to_screen_size" id=").i8mMAB6q[8N%`SL}P3">
+            <field name="size">224</field>
+            <next>
+              <block type="ai_model_object_load" id="5$=jpL.+pP57^Exor=!p">
                 <next>
                 <next>
-                  <block type="ai_model_object_load" id="i+arADdFw5N1?eriwg%p">
-                    <field name="varitem">img_objectrecognition</field>
+                  <block type="ai_model_look_attribute" id="a}?KN8L-O1PM8A%[|E?$">
                     <next>
                     <next>
-                      <block type="controls_if" id="Rt/XT}2Z,utCec?JYN^q">
-                        <value name="IF0">
-                          <block type="ai_model_look_attribute" id="=RTFko{{d5eU|eUy5BSv"></block>
-                        </value>
-                        <statement name="DO0">
-                          <block type="ai_model_look_new" id="{Okqq~iR*16*iv~}1FuV">
-                            <statement name="input">
-                              <block type="ai_lcd_textcarvas" id="k/}8[y%!9qSDG]0eLNwU">
-                                <field name="varitem">img_objectrecognition</field>
-                                <value name="POSA">
-                                  <block type="lcd_set_position" id="XG.OS%i94e+bc2ar9HT@" inline="false">
-                                    <value name="POSX">
-                                      <shadow type="math_number" id="#7@rtc^V1lw8_+3|mcBz">
-                                        <field name="NUM">10</field>
-                                      </shadow>
-                                      <block type="ai_model_get" id="9z+nG=9{AQc9]8Q_:BO*">
-                                        <field name="TYPE">X</field>
-                                      </block>
-                                    </value>
-                                    <value name="POSY">
-                                      <shadow type="math_number" id=":UaT#VlB^iW}RBxcw~Ov">
-                                        <field name="NUM">0</field>
-                                      </shadow>
-                                      <block type="math_arithmetic" id="#vpy6@n5g;H(T?azhR#}">
-                                        <field name="OP">MINUS</field>
-                                        <value name="A">
-                                          <shadow type="math_number" id=",_`D}o2C-;@eFuvJthlo">
-                                            <field name="NUM">1</field>
-                                          </shadow>
-                                          <block type="ai_model_get" id="yQN6lcp|@;vZJ?TB+K?d">
-                                            <field name="TYPE">Y</field>
-                                          </block>
-                                        </value>
-                                        <value name="B">
-                                          <shadow type="math_number" id="RE)#a;I15pSx$em#6nX4">
-                                            <field name="NUM">20</field>
-                                          </shadow>
-                                        </value>
-                                      </block>
-                                    </value>
-                                  </block>
-                                </value>
-                                <value name="CONTENT">
-                                  <shadow type="text" id="k2SINHd%8+CFUCgEm(Sx">
-                                    <field name="TEXT"></field>
-                                  </shadow>
-                                  <block type="text_join" id="mfj##o5p~m`#n4XK7:x4">
-                                    <mutation items="3"></mutation>
-                                    <value name="ADD0">
-                                      <block type="text_join" id="wnI(%g;8vY*_zueDcPv[">
-                                        <mutation items="1"></mutation>
-                                        <value name="ADD0">
-                                          <block type="ai_model_get" id="Y4VFyaXd^?8GgND.f-f2">
-                                            <field name="TYPE">Object</field>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="ADD1">
-                                      <block type="text" id="edu@OH%t.:7$a2VibU;K">
-                                        <field name="TEXT">,</field>
-                                      </block>
-                                    </value>
-                                    <value name="ADD2">
-                                      <block type="math_keep_decimal" id="Ge0j-6y,]i$X=%XG17g8">
-                                        <value name="NUM">
-                                          <shadow type="math_number" id="kRHQYT@K,RRacxNv)?:f">
-                                            <field name="NUM">3.1415926</field>
-                                          </shadow>
-                                          <block type="ai_model_get" id="N:.92xmE`^}02go=Dyks">
-                                            <field name="TYPE">Confidence</field>
-                                          </block>
-                                        </value>
-                                        <value name="PLACE">
-                                          <shadow type="math_number" id=")?-X}C3%@*O2F3*jZU}u">
-                                            <field name="NUM">2</field>
-                                          </shadow>
-                                        </value>
-                                      </block>
-                                    </value>
-                                  </block>
-                                </value>
-                                <value name="COLOR">
-                                  <block type="lcd_set_color" id="^3-Quk{6,pR.4o^=r3ji">
-                                    <field name="COLOR">#3366ff</field>
-                                  </block>
-                                </value>
-                                <value name="Scale">
-                                  <shadow type="math_number" id="ExSZ^ApS5jOI^Ra8hNz@">
-                                    <field name="NUM">1</field>
-                                  </shadow>
-                                </value>
-                                <next>
-                                  <block type="ai_lcd_draw_rectangle" id="^#[]+0]TO`3=n]#EJt6]">
-                                    <field name="varitem">img_objectrecognition</field>
-                                    <field name="rect_type">rect</field>
-                                    <value name="POSA">
-                                      <block type="lcd_set_position" id="eWuKe]3SKyFw0[qFyG*}" inline="false">
-                                        <value name="POSX">
-                                          <shadow type="math_number" id="%ESXKe+?@SzRTQ`Q6^Ky">
-                                            <field name="NUM">0</field>
-                                          </shadow>
-                                          <block type="ai_model_get" id="HrECPH]KY{ByQkP#sFyF">
-                                            <field name="TYPE">X</field>
-                                          </block>
-                                        </value>
-                                        <value name="POSY">
-                                          <shadow type="math_number" id="@+`}AB};DShu5Jg|Y.`_">
-                                            <field name="NUM">0</field>
-                                          </shadow>
-                                          <block type="ai_model_get" id="p:)J1}LTEd-$Oi{F@mPY">
-                                            <field name="TYPE">Y</field>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="POSB">
-                                      <block type="lcd_set_width_height" id="H::/JF__9;]$Z$(;r/:P" inline="false">
-                                        <value name="WIDTH">
-                                          <shadow type="math_number" id="xIlE]r9GsF7p0!+?@d}w">
-                                            <field name="NUM">240</field>
-                                          </shadow>
-                                          <block type="ai_model_get" id="(0MXDd`c)fCF/Z)HdiZV">
-                                            <field name="TYPE">2</field>
-                                          </block>
-                                        </value>
-                                        <value name="HEIGHT">
-                                          <shadow type="math_number" id="Sc)8W0Cwp/JVQbR+g=6g">
-                                            <field name="NUM">20</field>
-                                          </shadow>
-                                          <block type="ai_model_get" id="NtfB4xGr|Uc8v$.8[4+%">
-                                            <field name="TYPE">3</field>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="COLOR">
-                                      <block type="lcd_set_color" id="8V/HJD[AC6O5H#Z$TFAR">
-                                        <field name="COLOR">#ff0000</field>
-                                      </block>
-                                    </value>
-                                  </block>
-                                </next>
-                              </block>
-                            </statement>
-                          </block>
-                        </statement>
-                        <next>
-                          <block type="ai_lcd_showcarvas_set_display" id="4qp70MjO0_xvqUa1nl3I">
-                            <field name="varitem">img_objectrecognition</field>
-                          </block>
-                        </next>
-                      </block>
+                      <block type="ai_lcd_showcarvas_set_display" id="G53S9xg,q:=U=lWRg95p"></block>
                     </next>
                     </next>
                   </block>
                   </block>
                 </next>
                 </next>
               </block>
               </block>
-            </statement>
+            </next>
           </block>
           </block>
-        </next>
+        </statement>
       </block>
       </block>
     </next>
     </next>
   </block>
   </block>

+ 25 - 169
src/python/AI/猜拳手势识别.xml

@@ -1,181 +1,37 @@
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
-  <block type="ai_lcd_screeninit" id="C?v(YEe$x4G?o*-U1IXH" x="0" y="55">
-    <field name="isScreen">False</field>
-    <next>
-      <block type="ai_lcd_showcarvas_set_cord" id="R|N6U+9M/5]@8!GGdAa=">
-        <field name="varitem">img_guessworkrecognition</field>
-        <value name="xy">
-          <block type="lcd_set_position" id="M{X,uzczWd#)()m64o)q">
-            <value name="POSX">
-              <shadow type="math_number" id="T[qXqMrSqv.T3#Q,C0rW">
-                <field name="NUM">48</field>
-              </shadow>
-            </value>
-            <value name="POSY">
-              <shadow type="math_number" id="U@2veHd*^$MiZB9Yj|$1">
-                <field name="NUM">8</field>
-              </shadow>
-            </value>
-          </block>
+  <block type="ai_lcd_showcarvas_set_cord" id="y@{b*WZh|fe+.miBi0+@" x="162" y="135">
+    <value name="xy">
+      <block type="lcd_set_position" id="Dqg}xVvyGqRX0!-~lhO^">
+        <value name="POSX">
+          <shadow type="math_number" id="U2-:r]}#3|O9*Y?M%t72">
+            <field name="NUM">48</field>
+          </shadow>
+        </value>
+        <value name="POSY">
+          <shadow type="math_number" id="/3UMkRjN5ZxR9-!3YksA">
+            <field name="NUM">8</field>
+          </shadow>
         </value>
         </value>
-        <next>
-          <block type="controls_repeat_forever" id="w-?2s^`xT,GQ0)%06pK%">
-            <statement name="DO">
-              <block type="ai_camera_fit_to_screen_size" id="m`im`q@MGN[3o39tm4+i">
-                <field name="varitem">img_guessworkrecognition</field>
-                <field name="size">224</field>
+      </block>
+    </value>
+    <next>
+      <block type="controls_repeat_forever" id="G;eI?9/bLk8BCQx,uJ!a">
+        <statement name="DO">
+          <block type="ai_camera_fit_to_screen_size" id=").i8mMAB6q[8N%`SL}P3">
+            <field name="size">224</field>
+            <next>
+              <block type="ai_model_Guesswork_load" id="deLqc%(IfPNQbA_U%=IA">
                 <next>
                 <next>
-                  <block type="ai_model_Guesswork_load" id="@7enKAo#z2cpp-7CFpiW">
-                    <field name="varitem">img_guessworkrecognition</field>
+                  <block type="ai_model_Guesswork_look" id="/K-$MJZ-teJ..959).D/">
                     <next>
                     <next>
-                      <block type="controls_if" id="ZSL})nRwt8F?8Nu]k,QJ">
-                        <value name="IF0">
-                          <block type="ai_model_Guesswork_look" id="l5S/~R:cH0$i/:.jjH^;"></block>
-                        </value>
-                        <statement name="DO0">
-                          <block type="ai_model_Guesswork_look_new" id="df=7r5n8!_p0K9}F!vw6">
-                            <statement name="input">
-                              <block type="ai_lcd_textcarvas" id="k/}8[y%!9qSDG]0eLNwU">
-                                <field name="varitem">img_guessworkrecognition</field>
-                                <value name="POSA">
-                                  <block type="lcd_set_position" id="XG.OS%i94e+bc2ar9HT@">
-                                    <value name="POSX">
-                                      <shadow type="math_number" id="#7@rtc^V1lw8_+3|mcBz">
-                                        <field name="NUM">10</field>
-                                      </shadow>
-                                    </value>
-                                    <value name="POSY">
-                                      <shadow type="math_number" id=":UaT#VlB^iW}RBxcw~Ov">
-                                        <field name="NUM">0</field>
-                                      </shadow>
-                                    </value>
-                                  </block>
-                                </value>
-                                <value name="CONTENT">
-                                  <shadow type="text" id="k2SINHd%8+CFUCgEm(Sx">
-                                    <field name="TEXT"></field>
-                                  </shadow>
-                                  <block type="text_join" id="mfj##o5p~m`#n4XK7:x4">
-                                    <mutation items="2"></mutation>
-                                    <value name="ADD0">
-                                      <block type="text_join" id="wnI(%g;8vY*_zueDcPv[">
-                                        <mutation items="1"></mutation>
-                                        <value name="ADD0">
-                                          <block type="ai_model_Guesswork_get" id="+:[L=/-%IS!qLD?LJp:t">
-                                            <field name="TYPE">Object</field>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="ADD1">
-                                      <block type="text_append_text" id="d)+`j~,EXDw:RA3|W/=!">
-                                        <value name="text_abc">
-                                          <shadow type="text" id="(Xz!U!B3$0*Z{l|}?BS3">
-                                            <field name="TEXT">:</field>
-                                          </shadow>
-                                        </value>
-                                        <value name="append_text">
-                                          <shadow type="text" id="S|}l_t)Mh+;*+2Eb7lh8">
-                                            <field name="TEXT">def</field>
-                                          </shadow>
-                                          <block type="math_keep_decimal" id="Ge0j-6y,]i$X=%XG17g8">
-                                            <value name="NUM">
-                                              <shadow type="math_number" id="kRHQYT@K,RRacxNv)?:f">
-                                                <field name="NUM">3.1415926</field>
-                                              </shadow>
-                                              <block type="ai_model_Guesswork_get" id="FWCU=B2|^k$gVjf0K7-V">
-                                                <field name="TYPE">Confidence</field>
-                                              </block>
-                                            </value>
-                                            <value name="PLACE">
-                                              <shadow type="math_number" id=")?-X}C3%@*O2F3*jZU}u">
-                                                <field name="NUM">2</field>
-                                              </shadow>
-                                            </value>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                  </block>
-                                </value>
-                                <value name="COLOR">
-                                  <block type="lcd_set_color" id="^3-Quk{6,pR.4o^=r3ji">
-                                    <field name="COLOR">#ff0000</field>
-                                  </block>
-                                </value>
-                                <value name="Scale">
-                                  <shadow type="math_number" id="ExSZ^ApS5jOI^Ra8hNz@">
-                                    <field name="NUM">1</field>
-                                  </shadow>
-                                </value>
-                                <next>
-                                  <block type="ai_lcd_draw_rectangle" id="2!s7(=C/xgx%H%vEsEJu">
-                                    <field name="varitem">img_guessworkrecognition</field>
-                                    <field name="rect_type">rect</field>
-                                    <value name="POSA">
-                                      <block type="lcd_set_position" id="eWuKe]3SKyFw0[qFyG*}" inline="false">
-                                        <value name="POSX">
-                                          <shadow type="math_number" id="%ESXKe+?@SzRTQ`Q6^Ky">
-                                            <field name="NUM">0</field>
-                                          </shadow>
-                                          <block type="ai_model_Guesswork_get" id="68Fmg]L0+f13`RsblML9">
-                                            <field name="TYPE">X</field>
-                                          </block>
-                                        </value>
-                                        <value name="POSY">
-                                          <shadow type="math_number" id="@+`}AB};DShu5Jg|Y.`_">
-                                            <field name="NUM">0</field>
-                                          </shadow>
-                                          <block type="ai_model_Guesswork_get" id="m%d|$j5-D1#`}|3*9jx|">
-                                            <field name="TYPE">Y</field>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="POSB">
-                                      <block type="lcd_set_width_height" id="{PmutO@4.u^#[Cnjh_3." inline="false">
-                                        <value name="WIDTH">
-                                          <shadow type="math_number" id="jTX.TO*=z@A`gLBWU/k2">
-                                            <field name="NUM">320</field>
-                                          </shadow>
-                                          <block type="ai_model_Guesswork_get" id="5u)Hts{BbsBO(so|4~.s">
-                                            <field name="TYPE">2</field>
-                                          </block>
-                                        </value>
-                                        <value name="HEIGHT">
-                                          <shadow type="math_number" id="eKFk+SHp||CAe:Y/Ra]e">
-                                            <field name="NUM">240</field>
-                                          </shadow>
-                                          <block type="ai_model_Guesswork_get" id="*h609-a2gD8F/P0`~YtO">
-                                            <field name="TYPE">3</field>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="COLOR">
-                                      <block type="lcd_set_color" id="Anfw5O}|vIk2%z~6{!FW">
-                                        <field name="COLOR">#ff0000</field>
-                                      </block>
-                                    </value>
-                                  </block>
-                                </next>
-                              </block>
-                            </statement>
-                          </block>
-                        </statement>
-                        <next>
-                          <block type="ai_lcd_showcarvas_set_display" id="4qp70MjO0_xvqUa1nl3I">
-                            <field name="varitem">img_guessworkrecognition</field>
-                          </block>
-                        </next>
-                      </block>
+                      <block type="ai_lcd_showcarvas_set_display" id="G53S9xg,q:=U=lWRg95p"></block>
                     </next>
                     </next>
                   </block>
                   </block>
                 </next>
                 </next>
               </block>
               </block>
-            </statement>
+            </next>
           </block>
           </block>
-        </next>
+        </statement>
       </block>
       </block>
     </next>
     </next>
   </block>
   </block>

+ 51 - 197
src/python/AI/自学习.xml

@@ -3,7 +3,6 @@
     <field name="isScreen">False</field>
     <field name="isScreen">False</field>
     <next>
     <next>
       <block type="ai_lcd_showcarvas_set_cord" id="W7R|_~W5MK*6(A1*ncx(">
       <block type="ai_lcd_showcarvas_set_cord" id="W7R|_~W5MK*6(A1*ncx(">
-        <field name="varitem">learing_img</field>
         <value name="xy">
         <value name="xy">
           <block type="lcd_set_position" id="V@33YjROc@9OWD#E9cB5">
           <block type="lcd_set_position" id="V@33YjROc@9OWD#E9cB5">
             <value name="POSX">
             <value name="POSX">
@@ -41,217 +40,72 @@
               </block>
               </block>
             </value>
             </value>
             <next>
             <next>
-              <block type="variables_set" id="6lVz?hgC8P|We$J}5tr?">
-                <field name="VAR">is_train</field>
+              <block type="variables_set" id="/;mCyjS_H:7Ji1|M_M(q">
+                <field name="VAR">str_display</field>
                 <value name="VALUE">
                 <value name="VALUE">
-                  <shadow type="math_number" id="BI32+6B#}^)O+%Q}F:?e">
+                  <shadow type="math_number" id=",E{:e{.NH|~E%m)4}@]0">
                     <field name="NUM">0</field>
                     <field name="NUM">0</field>
                   </shadow>
                   </shadow>
+                  <block type="text" id="c+OdM`@_@UpoAAFv:dOE">
+                    <field name="TEXT">按C键添加类别,按D键進行学习</field>
+                  </block>
                 </value>
                 </value>
                 <next>
                 <next>
-                  <block type="variables_set" id="YnD@C_xVpWRSsOEN3I2T">
-                    <field name="VAR">count</field>
-                    <value name="VALUE">
-                      <shadow type="math_number" id="VRNHc6poWi|W^mRz8IX6">
-                        <field name="NUM">0</field>
-                      </shadow>
-                    </value>
-                    <next>
-                      <block type="variables_set" id="/;mCyjS_H:7Ji1|M_M(q">
-                        <field name="VAR">str_display</field>
-                        <value name="VALUE">
-                          <shadow type="math_number" id=",E{:e{.NH|~E%m)4}@]0">
-                            <field name="NUM">0</field>
-                          </shadow>
-                          <block type="text" id="c+OdM`@_@UpoAAFv:dOE">
-                            <field name="TEXT">按C键添加类别,按D键進行学习</field>
-                          </block>
-                        </value>
+                  <block type="controls_repeat_forever" id="pqagRq6*P%eDslmV%kJ.">
+                    <statement name="DO">
+                      <block type="ai_camera_fit_to_screen_size" id="3?olti;Iu)4W+60.i)u6">
+                        <field name="size">224</field>
                         <next>
                         <next>
-                          <block type="controls_repeat_forever" id="pqagRq6*P%eDslmV%kJ.">
-                            <statement name="DO">
-                              <block type="ai_camera_fit_to_screen_size" id="3?olti;Iu)4W+60.i)u6">
-                                <field name="varitem">learing_img</field>
-                                <field name="size">224</field>
+                          <block type="ai_lcd_textcarvas" id="nnSV:VW,N:!VUnb`8vx/">
+                            <value name="POSA">
+                              <block type="lcd_set_position" id="L{Q`p60%Yx}t5+7p.e%H">
+                                <value name="POSX">
+                                  <shadow type="math_number" id="~|C}(%aA9pKP0,8N~Vz@">
+                                    <field name="NUM">0</field>
+                                  </shadow>
+                                </value>
+                                <value name="POSY">
+                                  <shadow type="math_number" id="|p#/_P;5`0A9?Z/=fGtJ">
+                                    <field name="NUM">0</field>
+                                  </shadow>
+                                </value>
+                              </block>
+                            </value>
+                            <value name="CONTENT">
+                              <shadow type="text" id="KT6[TPX=8Gm+aGq}68qS">
+                                <field name="TEXT"></field>
+                              </shadow>
+                              <block type="variables_get" id="]R^|csr2LvlZV4BDc=W@">
+                                <field name="VAR">str_display</field>
+                              </block>
+                            </value>
+                            <value name="COLOR">
+                              <block type="lcd_set_color" id="s1eU7UuW]/L^*e#56$5x">
+                                <field name="COLOR">#ff0000</field>
+                              </block>
+                            </value>
+                            <value name="Scale">
+                              <shadow type="math_number" id="8.cY{ejjV8z_Oy#]E}E2">
+                                <field name="NUM">1</field>
+                              </shadow>
+                            </value>
+                            <next>
+                              <block type="ai_model_self_learning_add_class" id="p7;?Ei}/hAQY`h]bj@m!">
+                                <field name="button_type">C</field>
                                 <next>
                                 <next>
-                                  <block type="ai_lcd_textcarvas" id="nnSV:VW,N:!VUnb`8vx/">
-                                    <field name="varitem">learing_img</field>
-                                    <value name="POSA">
-                                      <block type="lcd_set_position" id="L{Q`p60%Yx}t5+7p.e%H">
-                                        <value name="POSX">
-                                          <shadow type="math_number" id="~|C}(%aA9pKP0,8N~Vz@">
-                                            <field name="NUM">0</field>
-                                          </shadow>
-                                        </value>
-                                        <value name="POSY">
-                                          <shadow type="math_number" id="|p#/_P;5`0A9?Z/=fGtJ">
-                                            <field name="NUM">0</field>
-                                          </shadow>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="CONTENT">
-                                      <shadow type="text" id="KT6[TPX=8Gm+aGq}68qS">
-                                        <field name="TEXT"></field>
-                                      </shadow>
-                                      <block type="variables_get" id="]R^|csr2LvlZV4BDc=W@">
-                                        <field name="VAR">str_display</field>
-                                      </block>
-                                    </value>
-                                    <value name="COLOR">
-                                      <block type="lcd_set_color" id="s1eU7UuW]/L^*e#56$5x">
-                                        <field name="COLOR">#ff0000</field>
-                                      </block>
-                                    </value>
-                                    <value name="Scale">
-                                      <shadow type="math_number" id="8.cY{ejjV8z_Oy#]E}E2">
-                                        <field name="NUM">1</field>
-                                      </shadow>
-                                    </value>
+                                  <block type="ai_model_self_learning_picture" id="4S;FcCInEg*iXPxFE7!d">
+                                    <field name="button_type">D</field>
                                     <next>
                                     <next>
-                                      <block type="ai_v831_button_read_released" id="{b1,=HVajie7=sv`!qq#">
-                                        <field name="button_type">C</field>
-                                        <statement name="input">
-                                          <block type="controls_if" id=")jZp/]!2YKBet,~S/bIJ">
-                                            <value name="IF0">
-                                              <block type="logic_compare" id="dBUV0xXCwk$SQM|f^,LY">
-                                                <field name="OP">LT</field>
-                                                <value name="A">
-                                                  <block type="variables_get" id="HIj-z9*(V]7PRdx6zUdV">
-                                                    <field name="VAR">count</field>
-                                                  </block>
-                                                </value>
-                                                <value name="B">
-                                                  <block type="math_number" id="#5t{Xpvo[/5?NHSw+XqN">
-                                                    <field name="NUM">3</field>
-                                                  </block>
-                                                </value>
-                                              </block>
-                                            </value>
-                                            <statement name="DO0">
-                                              <block type="ai_model_self_learning_add_class" id="w2YP]b$!5BJaQFaY3^hN">
-                                                <field name="varitem">learing_img</field>
-                                                <next>
-                                                  <block type="ai_model_self_learning_make_data_set" id="uW8TP70Tq9nk#[Jx,P|U">
-                                                    <field name="varitem">learing_img</field>
-                                                    <next>
-                                                      <block type="math_change" id="~~ylY:S)0RAu`WZ?jEzu">
-                                                        <field name="VAR">count</field>
-                                                        <value name="DELTA">
-                                                          <shadow type="math_number" id="6#P4#,%T+?DG[qSD,T^$">
-                                                            <field name="NUM">1</field>
-                                                          </shadow>
-                                                        </value>
-                                                      </block>
-                                                    </next>
-                                                  </block>
-                                                </next>
-                                              </block>
-                                            </statement>
-                                            <next>
-                                              <block type="variables_set" id="W6_I@Cx1{gmSUs!4:xBr">
-                                                <field name="VAR">str_display</field>
-                                                <value name="VALUE">
-                                                  <shadow type="math_number" id=",E{:e{.NH|~E%m)4}@]0">
-                                                    <field name="NUM">0</field>
-                                                  </shadow>
-                                                  <block type="text_join" id="^}-yj0Z}^g^G8/Mi~i?d">
-                                                    <mutation items="1"></mutation>
-                                                    <value name="ADD0">
-                                                      <block type="variables_get" id="Wpk_GItqzh)kFDtDFns]">
-                                                        <field name="VAR">count</field>
-                                                      </block>
-                                                    </value>
-                                                  </block>
-                                                </value>
-                                              </block>
-                                            </next>
-                                          </block>
-                                        </statement>
-                                        <next>
-                                          <block type="ai_v831_button_read_released" id="-VCC!SaDQ^zydNCD`uv~">
-                                            <field name="button_type">D</field>
-                                            <statement name="input">
-                                              <block type="controls_if" id="W|NCcOUKRwbQDIPHNJ3{">
-                                                <value name="IF0">
-                                                  <block type="logic_compare" id="4Qk/dQg^sgj4s]h*NY.G">
-                                                    <field name="OP">EQ</field>
-                                                    <value name="A">
-                                                      <block type="variables_get" id="X?|p/{c@7ynoA/`H|}-F">
-                                                        <field name="VAR">is_train</field>
-                                                      </block>
-                                                    </value>
-                                                    <value name="B">
-                                                      <block type="math_number" id="}ZSB|yXpoN*$o7tqT{oU">
-                                                        <field name="NUM">0</field>
-                                                      </block>
-                                                    </value>
-                                                  </block>
-                                                </value>
-                                                <statement name="DO0">
-                                                  <block type="time_delay" id="HNP7y.)*o|11iZ!6.DCV">
-                                                    <value name="DELAY_TIME_MILI">
-                                                      <block type="math_number" id="aMHJSuGFuOI.zOhc(Bc^">
-                                                        <field name="NUM">1000</field>
-                                                      </block>
-                                                    </value>
-                                                    <next>
-                                                      <block type="controls_if" id="qJU$ClZX,DQ[w}}Ky*v@">
-                                                        <value name="IF0">
-                                                          <block type="logic_compare" id="m,12G(jv+HR;x)Lv!rz2">
-                                                            <field name="OP">GTE</field>
-                                                            <value name="A">
-                                                              <block type="variables_get" id="YD9%+`a5P-y?[z)B|B9L">
-                                                                <field name="VAR">count</field>
-                                                              </block>
-                                                            </value>
-                                                            <value name="B">
-                                                              <block type="math_number" id="%x{,qgOWtj!`sE7~|Z([">
-                                                                <field name="NUM">3</field>
-                                                              </block>
-                                                            </value>
-                                                          </block>
-                                                        </value>
-                                                        <statement name="DO0">
-                                                          <block type="ai_model_self_learning_picture" id="C1):xHboa.G|}Hu7sn]k">
-                                                            <next>
-                                                              <block type="ai_model_self_learning_save_modal" id="/vS(AM/Q)sf[2qFf%~!5"></block>
-                                                            </next>
-                                                          </block>
-                                                        </statement>
-                                                        <next>
-                                                          <block type="variables_set" id="GT-HD9P?QyX2RZAtBpg.">
-                                                            <field name="VAR">is_train</field>
-                                                            <value name="VALUE">
-                                                              <shadow type="math_number" id="`b}iRiPWR,2i,@~1}d-u">
-                                                                <field name="NUM">1</field>
-                                                              </shadow>
-                                                            </value>
-                                                          </block>
-                                                        </next>
-                                                      </block>
-                                                    </next>
-                                                  </block>
-                                                </statement>
-                                              </block>
-                                            </statement>
-                                            <next>
-                                              <block type="ai_lcd_showcarvas_set_display" id="5%$VU]Wc+Di=y[*4,?u9">
-                                                <field name="varitem">learing_img</field>
-                                              </block>
-                                            </next>
-                                          </block>
-                                        </next>
-                                      </block>
+                                      <block type="ai_lcd_showcarvas_set_display" id="5%$VU]Wc+Di=y[*4,?u9"></block>
                                     </next>
                                     </next>
                                   </block>
                                   </block>
                                 </next>
                                 </next>
                               </block>
                               </block>
-                            </statement>
+                            </next>
                           </block>
                           </block>
                         </next>
                         </next>
                       </block>
                       </block>
-                    </next>
+                    </statement>
                   </block>
                   </block>
                 </next>
                 </next>
               </block>
               </block>

+ 1 - 8
src/python/AI/自学习识别.xml

@@ -3,7 +3,6 @@
     <field name="isScreen">False</field>
     <field name="isScreen">False</field>
     <next>
     <next>
       <block type="ai_lcd_showcarvas_set_cord" id="W7R|_~W5MK*6(A1*ncx(">
       <block type="ai_lcd_showcarvas_set_cord" id="W7R|_~W5MK*6(A1*ncx(">
-        <field name="varitem">learing_img</field>
         <value name="xy">
         <value name="xy">
           <block type="lcd_set_position" id="V@33YjROc@9OWD#E9cB5">
           <block type="lcd_set_position" id="V@33YjROc@9OWD#E9cB5">
             <value name="POSX">
             <value name="POSX">
@@ -44,14 +43,11 @@
               <block type="controls_repeat_forever" id="pqagRq6*P%eDslmV%kJ.">
               <block type="controls_repeat_forever" id="pqagRq6*P%eDslmV%kJ.">
                 <statement name="DO">
                 <statement name="DO">
                   <block type="ai_camera_fit_to_screen_size" id="3?olti;Iu)4W+60.i)u6">
                   <block type="ai_camera_fit_to_screen_size" id="3?olti;Iu)4W+60.i)u6">
-                    <field name="varitem">learing_img</field>
                     <field name="size">224</field>
                     <field name="size">224</field>
                     <next>
                     <next>
                       <block type="ai_model_self_learning_class_verification" id="AihW1:gB/^[:BwlE~045">
                       <block type="ai_model_self_learning_class_verification" id="AihW1:gB/^[:BwlE~045">
-                        <field name="varitem">learing_img</field>
                         <next>
                         <next>
                           <block type="ai_lcd_textcarvas" id="3*k1H#[8AQDn;$?yhE$^">
                           <block type="ai_lcd_textcarvas" id="3*k1H#[8AQDn;$?yhE$^">
-                            <field name="varitem">learing_img</field>
                             <value name="POSA">
                             <value name="POSA">
                               <block type="lcd_set_position" id="]OM$,XXbSEBIQakLD!c8">
                               <block type="lcd_set_position" id="]OM$,XXbSEBIQakLD!c8">
                                 <value name="POSX">
                                 <value name="POSX">
@@ -96,7 +92,6 @@
                             </value>
                             </value>
                             <next>
                             <next>
                               <block type="ai_lcd_textcarvas" id="|Cpa_SPKfI]a:FEa?KJl">
                               <block type="ai_lcd_textcarvas" id="|Cpa_SPKfI]a:FEa?KJl">
-                                <field name="varitem">learing_img</field>
                                 <value name="POSA">
                                 <value name="POSA">
                                   <block type="lcd_set_position" id="e6:g9BjP|`V0Va_@WI^^">
                                   <block type="lcd_set_position" id="e6:g9BjP|`V0Va_@WI^^">
                                     <value name="POSX">
                                     <value name="POSX">
@@ -140,9 +135,7 @@
                                   </shadow>
                                   </shadow>
                                 </value>
                                 </value>
                                 <next>
                                 <next>
-                                  <block type="ai_lcd_showcarvas_set_display" id="5%$VU]Wc+Di=y[*4,?u9">
-                                    <field name="varitem">learing_img</field>
-                                  </block>
+                                  <block type="ai_lcd_showcarvas_set_display" id="5%$VU]Wc+Di=y[*4,?u9"></block>
                                 </next>
                                 </next>
                               </block>
                               </block>
                             </next>
                             </next>

+ 60 - 210
src/python/AI/自定义训练识别.xml

@@ -1,223 +1,73 @@
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
-  <block type="ai_lcd_screeninit" id="C?v(YEe$x4G?o*-U1IXH" x="-165" y="-46">
-    <field name="isScreen">False</field>
-    <next>
-      <block type="ai_lcd_showcarvas_set_cord" id="W7R|_~W5MK*6(A1*ncx(">
-        <field name="varitem">img_detection</field>
-        <value name="xy">
-          <block type="lcd_set_position" id="V@33YjROc@9OWD#E9cB5">
-            <value name="POSX">
-              <shadow type="math_number" id=";5SG63c|BdKrCug!r@5$">
-                <field name="NUM">48</field>
-              </shadow>
-            </value>
-            <value name="POSY">
-              <shadow type="math_number" id="bA%|Dbq3+v?B(b5ikaLE">
-                <field name="NUM">8</field>
-              </shadow>
-            </value>
-          </block>
+  <block type="ai_lcd_showcarvas_set_cord" id="y@{b*WZh|fe+.miBi0+@" x="162" y="135">
+    <value name="xy">
+      <block type="lcd_set_position" id="Dqg}xVvyGqRX0!-~lhO^">
+        <value name="POSX">
+          <shadow type="math_number" id="U2-:r]}#3|O9*Y?M%t72">
+            <field name="NUM">48</field>
+          </shadow>
         </value>
         </value>
-        <next>
-          <block type="controls_repeat_forever" id="ELs)W_Hx[X)_F~lsO7IR">
-            <statement name="DO">
-              <block type="ai_camera_fit_to_screen_size" id="K#KKH]!q/#D3.b@AN5.6">
-                <field name="varitem">img_detection</field>
-                <field name="size">224</field>
-                <next>
-                  <block type="ai_model_customized_load_setup" id="J%n_%;q-Qs^g=):6KB8M">
-                    <field name="model_path">autologistics</field>
-                    <field name="varitem">img_detection</field>
-                    <value name="class_input">
-                      <block type="lists_create_with" id="%X7=Bz+x4b0oc~_)XD|Q">
-                        <mutation items="6"></mutation>
-                        <value name="ADD0">
-                          <block type="text" id="8E:}w7sLAPU-2{:cYiVP">
-                            <field name="TEXT">load</field>
-                          </block>
-                        </value>
-                        <value name="ADD1">
-                          <block type="text" id="%ZK^roKAzM.R8OkcIdTK">
-                            <field name="TEXT">unload</field>
-                          </block>
-                        </value>
-                        <value name="ADD2">
-                          <block type="text" id="NA*w_[cNx.2%BqPYas8_">
-                            <field name="TEXT">left</field>
-                          </block>
-                        </value>
-                        <value name="ADD3">
-                          <block type="text" id="FFCUwLnQ*:Sj,SS1_Kb(">
-                            <field name="TEXT">right</field>
-                          </block>
-                        </value>
-                        <value name="ADD4">
-                          <block type="text" id="z|o:rhz36C~$ow5^hl:]">
-                            <field name="TEXT">forward</field>
-                          </block>
-                        </value>
-                        <value name="ADD5">
-                          <block type="text" id="KLv0#D,[:e|K;+uM=2;u">
-                            <field name="TEXT">stop</field>
-                          </block>
-                        </value>
+        <value name="POSY">
+          <shadow type="math_number" id="/3UMkRjN5ZxR9-!3YksA">
+            <field name="NUM">8</field>
+          </shadow>
+        </value>
+      </block>
+    </value>
+    <next>
+      <block type="controls_repeat_forever" id="G;eI?9/bLk8BCQx,uJ!a">
+        <statement name="DO">
+          <block type="ai_camera_fit_to_screen_size" id=").i8mMAB6q[8N%`SL}P3">
+            <field name="size">224</field>
+            <next>
+              <block type="ai_model_customized_load_setup" id="MC;*H#QbcZUiS;+CoQge">
+                <field name="model_path">autologistics</field>
+                <value name="class_input">
+                  <block type="lists_create_with" id="%X7=Bz+x4b0oc~_)XD|Q">
+                    <mutation items="6"></mutation>
+                    <value name="ADD0">
+                      <block type="text" id="8E:}w7sLAPU-2{:cYiVP">
+                        <field name="TEXT">load</field>
                       </block>
                       </block>
                     </value>
                     </value>
-                    <next>
-                      <block type="controls_if" id="KbT!P1:,K,,D{bl%)w!t">
-                        <value name="IF0">
-                          <block type="ai_model_customized_if_got" id="zPOFL[T=PEc[[oh}tq}7"></block>
-                        </value>
-                        <statement name="DO0">
-                          <block type="ai_model_customized_if_got_new" id=".*{DHMy%J]_b++7~,Dv-">
-                            <statement name="input">
-                              <block type="ai_lcd_textcarvas" id="aGX/Pj5KgfiH(m/:h/oe">
-                                <field name="varitem">img_detection</field>
-                                <value name="POSA">
-                                  <block type="lcd_set_position" id="Xb$d!U8u(nH`M7nXF+Ac">
-                                    <value name="POSX">
-                                      <shadow type="math_number" id="fFgjm8!2gG16,:XSR]a0">
-                                        <field name="NUM">0</field>
-                                      </shadow>
-                                      <block type="ai_model_customized_get_result" id="+y`|[oUwigvmYn14u$!@">
-                                        <field name="get_results">x</field>
-                                      </block>
-                                    </value>
-                                    <value name="POSY">
-                                      <shadow type="math_number" id="3}O[c$jDPgF/{yXh.?Kc">
-                                        <field name="NUM">0</field>
-                                      </shadow>
-                                      <block type="ai_model_customized_get_result" id="sVy}LO*4Umu=tT!ywspB">
-                                        <field name="get_results">y</field>
-                                      </block>
-                                    </value>
-                                  </block>
-                                </value>
-                                <value name="CONTENT">
-                                  <shadow type="text" id="a0Ycl;@V^@HDUui-pA{B">
-                                    <field name="TEXT"></field>
-                                  </shadow>
-                                  <block type="text_join" id="X1IR6WOAvnk^wU@feS2-">
-                                    <mutation items="3"></mutation>
-                                    <value name="ADD0">
-                                      <block type="ai_model_customized_get_result" id="SiOp/5xVN|KMCs:iPR}n">
-                                        <field name="get_results">classid</field>
-                                      </block>
-                                    </value>
-                                    <value name="ADD1">
-                                      <block type="text" id="a~@FQ2*9QHpIM/geA{^P">
-                                        <field name="TEXT">;</field>
-                                      </block>
-                                    </value>
-                                    <value name="ADD2">
-                                      <block type="text_append_text" id="o|ZGK5Ac{;;LNSzL{[0s">
-                                        <value name="text_abc">
-                                          <shadow type="text" id="1HIpm$7q.7pbP;{BDVjE">
-                                            <field name="TEXT">abc</field>
-                                          </shadow>
-                                          <block type="math_keep_decimal" id="(HTF(F%;fvX#9m5g55@F">
-                                            <value name="NUM">
-                                              <shadow type="math_number" id="5!TO(O:]B1W^V}t#w=Hj">
-                                                <field name="NUM">3.1415926</field>
-                                              </shadow>
-                                              <block type="ai_model_customized_get_result" id="J8/d]v.@GDP6mGyuUAk7">
-                                                <field name="get_results">value</field>
-                                              </block>
-                                            </value>
-                                            <value name="PLACE">
-                                              <shadow type="math_number" id="l5LY/E3Kz7q!O2N#r8;8">
-                                                <field name="NUM">2</field>
-                                              </shadow>
-                                            </value>
-                                          </block>
-                                        </value>
-                                        <value name="append_text">
-                                          <shadow type="text" id="~)LkOaD(v`oCOnAdd/$.">
-                                            <field name="TEXT">%</field>
-                                          </shadow>
-                                        </value>
-                                      </block>
-                                    </value>
-                                  </block>
-                                </value>
-                                <value name="COLOR">
-                                  <block type="lcd_set_color" id="D+:YG2S2[t;uJ{6YX09=">
-                                    <field name="COLOR">#ff0000</field>
-                                  </block>
-                                </value>
-                                <value name="Scale">
-                                  <shadow type="math_number" id="I$z_7Y$qf2a|Lu:qq[ow">
-                                    <field name="NUM">1</field>
-                                  </shadow>
-                                </value>
-                                <next>
-                                  <block type="ai_lcd_draw_rectangle" id="r`uK^UFZ!_muP4(TwYLA">
-                                    <field name="varitem">img_detection</field>
-                                    <field name="rect_type">rect</field>
-                                    <value name="POSA">
-                                      <block type="lcd_set_position" id="pD_WC:k)?uU).#`9VN~}">
-                                        <value name="POSX">
-                                          <shadow type="math_number" id="fFgjm8!2gG16,:XSR]a0">
-                                            <field name="NUM">0</field>
-                                          </shadow>
-                                          <block type="ai_model_customized_get_result" id="S01mO2,3ofx-`7(xI}P?">
-                                            <field name="get_results">x</field>
-                                          </block>
-                                        </value>
-                                        <value name="POSY">
-                                          <shadow type="math_number" id="3}O[c$jDPgF/{yXh.?Kc">
-                                            <field name="NUM">0</field>
-                                          </shadow>
-                                          <block type="ai_model_customized_get_result" id="FdBn5LyhJo[{or.4JKpQ">
-                                            <field name="get_results">y</field>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="POSB">
-                                      <block type="lcd_set_width_height" id="e?5fuA~suA5*qc/?ge~6">
-                                        <value name="WIDTH">
-                                          <shadow type="math_number" id="yN0tB?v0?ScY5d`_4d!D">
-                                            <field name="NUM">320</field>
-                                          </shadow>
-                                          <block type="ai_model_customized_get_result" id="IX8N5Nd(kFxEZ!`Dkb;V">
-                                            <field name="get_results">2</field>
-                                          </block>
-                                        </value>
-                                        <value name="HEIGHT">
-                                          <shadow type="math_number" id="N3AC2^QA^b?kEH4AP=FJ">
-                                            <field name="NUM">240</field>
-                                          </shadow>
-                                          <block type="ai_model_customized_get_result" id="gKW^-mAH6?a8DJxygcvm">
-                                            <field name="get_results">3</field>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="COLOR">
-                                      <block type="lcd_set_color" id="JJU$Q/()D/]%8efBWIQ9">
-                                        <field name="COLOR">#ff0000</field>
-                                      </block>
-                                    </value>
-                                  </block>
-                                </next>
-                              </block>
-                            </statement>
-                          </block>
-                        </statement>
-                        <next>
-                          <block type="ai_lcd_showcarvas_set_display" id="JX:Wp@oAZ+Ib41=Dzk|7">
-                            <field name="varitem">img_detection</field>
-                          </block>
-                        </next>
+                    <value name="ADD1">
+                      <block type="text" id="%ZK^roKAzM.R8OkcIdTK">
+                        <field name="TEXT">unload</field>
                       </block>
                       </block>
+                    </value>
+                    <value name="ADD2">
+                      <block type="text" id="NA*w_[cNx.2%BqPYas8_">
+                        <field name="TEXT">left</field>
+                      </block>
+                    </value>
+                    <value name="ADD3">
+                      <block type="text" id="FFCUwLnQ*:Sj,SS1_Kb(">
+                        <field name="TEXT">right</field>
+                      </block>
+                    </value>
+                    <value name="ADD4">
+                      <block type="text" id="z|o:rhz36C~$ow5^hl:]">
+                        <field name="TEXT">forward</field>
+                      </block>
+                    </value>
+                    <value name="ADD5">
+                      <block type="text" id="KLv0#D,[:e|K;+uM=2;u">
+                        <field name="TEXT">stop</field>
+                      </block>
+                    </value>
+                  </block>
+                </value>
+                <next>
+                  <block type="ai_model_customized_if_got" id=")yu;fA|q:%OZNh,r3JdK">
+                    <next>
+                      <block type="ai_lcd_showcarvas_set_display" id="G53S9xg,q:=U=lWRg95p"></block>
                     </next>
                     </next>
                   </block>
                   </block>
                 </next>
                 </next>
               </block>
               </block>
-            </statement>
+            </next>
           </block>
           </block>
-        </next>
+        </statement>
       </block>
       </block>
     </next>
     </next>
   </block>
   </block>

+ 52 - 24
src/python/AI/语音录制识别.xml

@@ -1,38 +1,66 @@
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
-  <block type="ai_lcd_showcarvas_set_cord" id="IQLSM:OR:/gbd]GBk)0W" x="328" y="316">
-    <field name="varitem">canvas</field>
-    <value name="xy">
-      <block type="lcd_set_position" id="(2pchv#R#lia65O.ny=I">
-        <value name="POSX">
-          <shadow type="math_number" id="zToj$F^BON_5#+$7h3Q(">
-            <field name="NUM">0</field>
-          </shadow>
-        </value>
-        <value name="POSY">
-          <shadow type="math_number" id="=%20xHVTQ}C@IOd2,]Wc">
-            <field name="NUM">0</field>
-          </shadow>
-        </value>
-      </block>
-    </value>
+  <block type="ai_lcd_screeninit" id="d;Ksdnix[jRUmJzM]$rJ" x="301" y="-20">
+    <field name="isScreen">False</field>
     <next>
     <next>
-      <block type="controls_repeat_forever" id=",m!+a+([9T?7N}Sr.8y(">
-        <statement name="DO">
-          <block type="ai_lcd_clearcanvas" id="`K%47wAIfO~4)(u0f*eP">
+      <block type="speech_recognition_new_setup" id="XmKN1nCa/$6m0Hd5KUsl">
+        <next>
+          <block type="ai_lcd_createnonecarvas" id="[ra_W5oJrHLPhQkzANBV">
             <field name="varitem">canvas</field>
             <field name="varitem">canvas</field>
+            <value name="wh">
+              <block type="lcd_set_width_height" id="..A;q#pvs655{0r%@J/s">
+                <value name="WIDTH">
+                  <shadow type="math_number" id="]KLD[sGzEQ|7)6!%1SX+">
+                    <field name="NUM">320</field>
+                  </shadow>
+                </value>
+                <value name="HEIGHT">
+                  <shadow type="math_number" id="Xp*SYswxh|m*D6zP{WI0">
+                    <field name="NUM">240</field>
+                  </shadow>
+                </value>
+              </block>
+            </value>
             <next>
             <next>
-              <block type="speech_recognition_record_start_result" id="xWK]IP!:F[1b4(0Qg3~S">
-                <field name="clip">2</field>
+              <block type="ai_lcd_showcarvas_set_cord" id="IQLSM:OR:/gbd]GBk)0W">
                 <field name="varitem">canvas</field>
                 <field name="varitem">canvas</field>
+                <value name="xy">
+                  <block type="lcd_set_position" id="(2pchv#R#lia65O.ny=I">
+                    <value name="POSX">
+                      <shadow type="math_number" id="zToj$F^BON_5#+$7h3Q(">
+                        <field name="NUM">0</field>
+                      </shadow>
+                    </value>
+                    <value name="POSY">
+                      <shadow type="math_number" id="=%20xHVTQ}C@IOd2,]Wc">
+                        <field name="NUM">0</field>
+                      </shadow>
+                    </value>
+                  </block>
+                </value>
                 <next>
                 <next>
-                  <block type="ai_lcd_showcarvas_set_display" id="2r0?mSc%^Umq{@?u*U;?">
-                    <field name="varitem">canvas</field>
+                  <block type="controls_repeat_forever" id=",m!+a+([9T?7N}Sr.8y(">
+                    <statement name="DO">
+                      <block type="ai_lcd_clearcanvas" id="`K%47wAIfO~4)(u0f*eP">
+                        <field name="varitem">canvas</field>
+                        <next>
+                          <block type="speech_recognition_record_start_result" id="xWK]IP!:F[1b4(0Qg3~S">
+                            <field name="clip">2</field>
+                            <field name="varitem">canvas</field>
+                            <next>
+                              <block type="ai_lcd_showcarvas_set_display" id="2r0?mSc%^Umq{@?u*U;?">
+                                <field name="varitem">canvas</field>
+                              </block>
+                            </next>
+                          </block>
+                        </next>
+                      </block>
+                    </statement>
                   </block>
                   </block>
                 </next>
                 </next>
               </block>
               </block>
             </next>
             </next>
           </block>
           </block>
-        </statement>
+        </next>
       </block>
       </block>
     </next>
     </next>
   </block>
   </block>

+ 150 - 125
src/python/AI/语音录制(识别).xml

@@ -1,160 +1,185 @@
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
-  <block type="ai_lcd_showcarvas_set_cord" id="dYVAjg0{][gE`jmO8|aj" x="408" y="68">
-    <field name="varitem">canvas</field>
-    <value name="xy">
-      <block type="lcd_set_position" id="Juir/#^vk}Zi[qnxxX`v">
-        <value name="POSX">
-          <shadow type="math_number" id="BBHWttnb(e/tm!cudFL%">
-            <field name="NUM">0</field>
-          </shadow>
-        </value>
-        <value name="POSY">
-          <shadow type="math_number" id="`5kr|%KhUe6LrJ?ZLh}B">
-            <field name="NUM">0</field>
-          </shadow>
-        </value>
-      </block>
-    </value>
+  <block type="ai_lcd_screeninit" id="Uif:-r2^H3GiX9][{mJS" x="411" y="15">
+    <field name="isScreen">False</field>
     <next>
     <next>
-      <block type="controls_repeat_forever" id="]/Y!0vYN(`42/[n4Y(L*">
-        <statement name="DO">
-          <block type="ai_lcd_clearcanvas" id="HSfLsZp:HM=r59LHnuUZ">
-            <field name="varitem">canvas</field>
+      <block type="ai_lcd_createnonecarvas" id="6g@4BRWi-=5l^.%k9vnj">
+        <field name="varitem">canvas</field>
+        <value name="wh">
+          <block type="lcd_set_width_height" id="Dpb[*RcR?t%rm8o9qX*]">
+            <value name="WIDTH">
+              <shadow type="math_number" id="=TV(ic+aK6h%x^BkX=/,">
+                <field name="NUM">320</field>
+              </shadow>
+            </value>
+            <value name="HEIGHT">
+              <shadow type="math_number" id="*{WzCD?5u]Ph#)}C1tM|">
+                <field name="NUM">240</field>
+              </shadow>
+            </value>
+          </block>
+        </value>
+        <next>
+          <block type="speech_recognition_new_setup" id="yYr0xlSfl%CMD2u2Rl1|">
             <next>
             <next>
-              <block type="ai_lcd_textcarvas" id="ID;+,}*A/Z=*q!JM=YW2">
-                <field name="isScreen">False</field>
+              <block type="ai_lcd_showcarvas_set_cord" id="dYVAjg0{][gE`jmO8|aj">
                 <field name="varitem">canvas</field>
                 <field name="varitem">canvas</field>
-                <value name="POSA">
-                  <block type="lcd_set_position" id="(5YYbOnSGSZ!TI/x3j7)">
+                <value name="xy">
+                  <block type="lcd_set_position" id="Juir/#^vk}Zi[qnxxX`v">
                     <value name="POSX">
                     <value name="POSX">
-                      <shadow type="math_number" id="fYaLC#:`rT4[I.AZx3[}">
+                      <shadow type="math_number" id="BBHWttnb(e/tm!cudFL%">
                         <field name="NUM">0</field>
                         <field name="NUM">0</field>
                       </shadow>
                       </shadow>
                     </value>
                     </value>
                     <value name="POSY">
                     <value name="POSY">
-                      <shadow type="math_number" id=")-yD[qQSGdoE0}k|8l^K">
+                      <shadow type="math_number" id="`5kr|%KhUe6LrJ?ZLh}B">
                         <field name="NUM">0</field>
                         <field name="NUM">0</field>
                       </shadow>
                       </shadow>
                     </value>
                     </value>
                   </block>
                   </block>
                 </value>
                 </value>
-                <value name="CONTENT">
-                  <shadow type="text" id="U3*)p0ZdO_f|Y/)OH-eZ">
-                    <field name="TEXT">识别中</field>
-                  </shadow>
-                </value>
-                <value name="COLOR">
-                  <block type="lcd_set_color" id="nDxE%8kE9=?7KHdQY50H">
-                    <field name="COLOR">#33cc00</field>
-                  </block>
-                </value>
-                <value name="Scale">
-                  <shadow type="math_number" id="2WT9_qVP)H/$=*aoeJQJ">
-                    <field name="NUM">1</field>
-                  </shadow>
-                </value>
                 <next>
                 <next>
-                  <block type="speech_recognition_new_start_recognition" id="pc4^6Xb{xEuyI9+|=VH]">
-                    <next>
-                      <block type="speech_recognition_new_recognition_get_any_result" id="K|5I.73NZZkHbZg_urnG">
-                        <statement name="NAME">
-                          <block type="controls_if" id="~EJ_cER-Mo#ezqoE.GMC">
-                            <mutation elseif="1"></mutation>
-                            <value name="IF0">
-                              <block type="speech_recognition_new_recognition_get_result" id="|q,nXiPAsJ6#q0@)ZzPl">
-                                <field name="index">1</field>
-                              </block>
-                            </value>
-                            <statement name="DO0">
-                              <block type="ai_lcd_textcarvas" id="-G1yrfU%*+,,uVEmju#T">
-                                <field name="isScreen">False</field>
-                                <field name="varitem">canvas</field>
-                                <value name="POSA">
-                                  <block type="lcd_set_position" id="xMx#Yt)BsVtpbeLrK.}|">
-                                    <value name="POSX">
-                                      <shadow type="math_number" id="ipQ6[d;=.v+Q`W[NF#eY">
-                                        <field name="NUM">0</field>
-                                      </shadow>
-                                    </value>
-                                    <value name="POSY">
-                                      <shadow type="math_number" id="lat]ajRdoU2-R;8#TPgD">
-                                        <field name="NUM">30</field>
-                                      </shadow>
-                                    </value>
-                                  </block>
-                                </value>
-                                <value name="CONTENT">
-                                  <shadow type="text" id="e8I3+e=#44Bl/U0FxWm?">
-                                    <field name="TEXT">识别片段:1</field>
+                  <block type="controls_repeat_forever" id="]/Y!0vYN(`42/[n4Y(L*">
+                    <statement name="DO">
+                      <block type="ai_lcd_clearcanvas" id="HSfLsZp:HM=r59LHnuUZ">
+                        <field name="varitem">canvas</field>
+                        <next>
+                          <block type="ai_lcd_textcarvas" id="ID;+,}*A/Z=*q!JM=YW2">
+                            <field name="varitem">canvas</field>
+                            <value name="POSA">
+                              <block type="lcd_set_position" id="(5YYbOnSGSZ!TI/x3j7)">
+                                <value name="POSX">
+                                  <shadow type="math_number" id="fYaLC#:`rT4[I.AZx3[}">
+                                    <field name="NUM">0</field>
                                   </shadow>
                                   </shadow>
                                 </value>
                                 </value>
-                                <value name="COLOR">
-                                  <block type="lcd_set_color" id="y]6K!Dmr97FzughpZm|b">
-                                    <field name="COLOR">#33cc00</field>
-                                  </block>
-                                </value>
-                                <value name="Scale">
-                                  <shadow type="math_number" id="6cLrHctC(Oo*Suu|X(GJ">
-                                    <field name="NUM">1</field>
+                                <value name="POSY">
+                                  <shadow type="math_number" id=")-yD[qQSGdoE0}k|8l^K">
+                                    <field name="NUM">0</field>
                                   </shadow>
                                   </shadow>
                                 </value>
                                 </value>
                               </block>
                               </block>
-                            </statement>
-                            <value name="IF1">
-                              <block type="speech_recognition_new_recognition_get_result" id="d69+ehu$`Hq{#LVpX9;Q">
-                                <field name="index">2</field>
+                            </value>
+                            <value name="CONTENT">
+                              <shadow type="text" id="U3*)p0ZdO_f|Y/)OH-eZ">
+                                <field name="TEXT">识别中</field>
+                              </shadow>
+                            </value>
+                            <value name="COLOR">
+                              <block type="lcd_set_color" id="nDxE%8kE9=?7KHdQY50H">
+                                <field name="COLOR">#33cc00</field>
                               </block>
                               </block>
                             </value>
                             </value>
-                            <statement name="DO1">
-                              <block type="ai_lcd_textcarvas" id="CtowX9_[feFx%lvB648q">
-                                <field name="isScreen">False</field>
-                                <field name="varitem">canvas</field>
-                                <value name="POSA">
-                                  <block type="lcd_set_position" id="cjVK)5x;XqP19*raGC#(">
-                                    <value name="POSX">
-                                      <shadow type="math_number" id="4nGHyMZHzFRbF]i2I^!b">
-                                        <field name="NUM">0</field>
-                                      </shadow>
-                                    </value>
-                                    <value name="POSY">
-                                      <shadow type="math_number" id="z_/3BI`e[nyM(:vW#CeH">
-                                        <field name="NUM">30</field>
-                                      </shadow>
-                                    </value>
-                                  </block>
-                                </value>
-                                <value name="CONTENT">
-                                  <shadow type="text" id=",%!8L0M2X1{l-$Od5LRJ">
-                                    <field name="TEXT">识别片段:2</field>
-                                  </shadow>
-                                </value>
-                                <value name="COLOR">
-                                  <block type="lcd_set_color" id="_yB{]ci*k:??S2b6*#Qd">
-                                    <field name="COLOR">#33cc00</field>
+                            <value name="Scale">
+                              <shadow type="math_number" id="2WT9_qVP)H/$=*aoeJQJ">
+                                <field name="NUM">1</field>
+                              </shadow>
+                            </value>
+                            <next>
+                              <block type="speech_recognition_new_start_recognition" id="pc4^6Xb{xEuyI9+|=VH]">
+                                <next>
+                                  <block type="speech_recognition_new_recognition_get_any_result" id="K|5I.73NZZkHbZg_urnG">
+                                    <statement name="NAME">
+                                      <block type="controls_if" id="~EJ_cER-Mo#ezqoE.GMC">
+                                        <mutation elseif="1"></mutation>
+                                        <value name="IF0">
+                                          <block type="speech_recognition_new_recognition_get_result" id="|q,nXiPAsJ6#q0@)ZzPl">
+                                            <field name="index">1</field>
+                                          </block>
+                                        </value>
+                                        <statement name="DO0">
+                                          <block type="ai_lcd_textcarvas" id="-G1yrfU%*+,,uVEmju#T">
+                                            <field name="varitem">canvas</field>
+                                            <value name="POSA">
+                                              <block type="lcd_set_position" id="xMx#Yt)BsVtpbeLrK.}|">
+                                                <value name="POSX">
+                                                  <shadow type="math_number" id="ipQ6[d;=.v+Q`W[NF#eY">
+                                                    <field name="NUM">0</field>
+                                                  </shadow>
+                                                </value>
+                                                <value name="POSY">
+                                                  <shadow type="math_number" id="lat]ajRdoU2-R;8#TPgD">
+                                                    <field name="NUM">30</field>
+                                                  </shadow>
+                                                </value>
+                                              </block>
+                                            </value>
+                                            <value name="CONTENT">
+                                              <shadow type="text" id="e8I3+e=#44Bl/U0FxWm?">
+                                                <field name="TEXT">识别片段:1</field>
+                                              </shadow>
+                                            </value>
+                                            <value name="COLOR">
+                                              <block type="lcd_set_color" id="y]6K!Dmr97FzughpZm|b">
+                                                <field name="COLOR">#33cc00</field>
+                                              </block>
+                                            </value>
+                                            <value name="Scale">
+                                              <shadow type="math_number" id="6cLrHctC(Oo*Suu|X(GJ">
+                                                <field name="NUM">1</field>
+                                              </shadow>
+                                            </value>
+                                          </block>
+                                        </statement>
+                                        <value name="IF1">
+                                          <block type="speech_recognition_new_recognition_get_result" id="d69+ehu$`Hq{#LVpX9;Q">
+                                            <field name="index">2</field>
+                                          </block>
+                                        </value>
+                                        <statement name="DO1">
+                                          <block type="ai_lcd_textcarvas" id="CtowX9_[feFx%lvB648q">
+                                            <field name="varitem">canvas</field>
+                                            <value name="POSA">
+                                              <block type="lcd_set_position" id="cjVK)5x;XqP19*raGC#(">
+                                                <value name="POSX">
+                                                  <shadow type="math_number" id="4nGHyMZHzFRbF]i2I^!b">
+                                                    <field name="NUM">0</field>
+                                                  </shadow>
+                                                </value>
+                                                <value name="POSY">
+                                                  <shadow type="math_number" id="z_/3BI`e[nyM(:vW#CeH">
+                                                    <field name="NUM">30</field>
+                                                  </shadow>
+                                                </value>
+                                              </block>
+                                            </value>
+                                            <value name="CONTENT">
+                                              <shadow type="text" id=",%!8L0M2X1{l-$Od5LRJ">
+                                                <field name="TEXT">识别片段:2</field>
+                                              </shadow>
+                                            </value>
+                                            <value name="COLOR">
+                                              <block type="lcd_set_color" id="_yB{]ci*k:??S2b6*#Qd">
+                                                <field name="COLOR">#33cc00</field>
+                                              </block>
+                                            </value>
+                                            <value name="Scale">
+                                              <shadow type="math_number" id="*$(`xPVq*DCDT9a:*;q/">
+                                                <field name="NUM">1</field>
+                                              </shadow>
+                                            </value>
+                                          </block>
+                                        </statement>
+                                      </block>
+                                    </statement>
+                                    <next>
+                                      <block type="ai_lcd_showcarvas_set_display" id="?g,Z^w,-$BBQfI1iklzK">
+                                        <field name="varitem">canvas</field>
+                                      </block>
+                                    </next>
                                   </block>
                                   </block>
-                                </value>
-                                <value name="Scale">
-                                  <shadow type="math_number" id="*$(`xPVq*DCDT9a:*;q/">
-                                    <field name="NUM">1</field>
-                                  </shadow>
-                                </value>
+                                </next>
                               </block>
                               </block>
-                            </statement>
-                          </block>
-                        </statement>
-                        <next>
-                          <block type="ai_lcd_showcarvas_set_display" id="?g,Z^w,-$BBQfI1iklzK">
-                            <field name="varitem">canvas</field>
+                            </next>
                           </block>
                           </block>
                         </next>
                         </next>
                       </block>
                       </block>
-                    </next>
+                    </statement>
                   </block>
                   </block>
                 </next>
                 </next>
               </block>
               </block>
             </next>
             </next>
           </block>
           </block>
-        </statement>
+        </next>
       </block>
       </block>
     </next>
     </next>
   </block>
   </block>

+ 25 - 141
src/python/AI/车牌识别.xml

@@ -1,153 +1,37 @@
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
 <xml xmlns="http://www.w3.org/1999/xhtml" type="IoT">
-  <block type="ai_lcd_screeninit" id="C?v(YEe$x4G?o*-U1IXH" x="-168" y="-29">
-    <field name="isScreen">False</field>
-    <next>
-      <block type="ai_lcd_showcarvas_set_cord" id="W7R|_~W5MK*6(A1*ncx(">
-        <field name="varitem">img_card_recognition</field>
-        <value name="xy">
-          <block type="lcd_set_position" id="V@33YjROc@9OWD#E9cB5">
-            <value name="POSX">
-              <shadow type="math_number" id=";5SG63c|BdKrCug!r@5$">
-                <field name="NUM">48</field>
-              </shadow>
-            </value>
-            <value name="POSY">
-              <shadow type="math_number" id="bA%|Dbq3+v?B(b5ikaLE">
-                <field name="NUM">8</field>
-              </shadow>
-            </value>
-          </block>
+  <block type="ai_lcd_showcarvas_set_cord" id="y@{b*WZh|fe+.miBi0+@" x="162" y="135">
+    <value name="xy">
+      <block type="lcd_set_position" id="Dqg}xVvyGqRX0!-~lhO^">
+        <value name="POSX">
+          <shadow type="math_number" id="U2-:r]}#3|O9*Y?M%t72">
+            <field name="NUM">48</field>
+          </shadow>
+        </value>
+        <value name="POSY">
+          <shadow type="math_number" id="/3UMkRjN5ZxR9-!3YksA">
+            <field name="NUM">8</field>
+          </shadow>
         </value>
         </value>
-        <next>
-          <block type="controls_repeat_forever" id="ELs)W_Hx[X)_F~lsO7IR">
-            <statement name="DO">
-              <block type="ai_camera_fit_to_screen_size" id="GZ-3RAL#WQD0x)o%orQl">
-                <field name="varitem">img_card_recognition</field>
-                <field name="size">224</field>
+      </block>
+    </value>
+    <next>
+      <block type="controls_repeat_forever" id="G;eI?9/bLk8BCQx,uJ!a">
+        <statement name="DO">
+          <block type="ai_camera_fit_to_screen_size" id=").i8mMAB6q[8N%`SL}P3">
+            <field name="size">224</field>
+            <next>
+              <block type="ai_model_card_recognition_load" id="/8X_(`IplzCsGdw=O0#l">
                 <next>
                 <next>
-                  <block type="ai_model_card_recognition_load" id="T=bN7};!kZbFP}/wIY_A">
-                    <field name="varitem">img_card_recognition</field>
+                  <block type="ai_model_card_xy" id="CL*hsw+oEjgM-L1$Pmk]">
                     <next>
                     <next>
-                      <block type="controls_if" id="u#})DF%*Pw%NW.~v*:xP">
-                        <value name="IF0">
-                          <block type="ai_model_card_xy" id="*}As4ATv5M%h`*qMZ^@`"></block>
-                        </value>
-                        <statement name="DO0">
-                          <block type="ai_model_card_xy_new" id="]p5S|rDH89]*-obi1TgQ">
-                            <statement name="input">
-                              <block type="ai_lcd_draw_rectangle" id="x*NAS!X`?M2mLvA``D!l">
-                                <field name="varitem">img_card_recognition</field>
-                                <field name="rect_type">rect</field>
-                                <value name="POSA">
-                                  <block type="lcd_set_position" id="pD_WC:k)?uU).#`9VN~}" inline="false">
-                                    <value name="POSX">
-                                      <shadow type="math_number" id="fFgjm8!2gG16,:XSR]a0">
-                                        <field name="NUM">0</field>
-                                      </shadow>
-                                      <block type="ai_model_card_get" id="hd*wU~p0~:j%A+MYQTgO">
-                                        <field name="TYPE">X</field>
-                                      </block>
-                                    </value>
-                                    <value name="POSY">
-                                      <shadow type="math_number" id="3}O[c$jDPgF/{yXh.?Kc">
-                                        <field name="NUM">0</field>
-                                      </shadow>
-                                      <block type="ai_model_card_get" id="k.bF8[T?Zvc;`uo2O@pF">
-                                        <field name="TYPE">Y</field>
-                                      </block>
-                                    </value>
-                                  </block>
-                                </value>
-                                <value name="POSB">
-                                  <block type="lcd_set_width_height" id="4%d0l};S+ksYVxyHp!Sh" inline="false">
-                                    <value name="WIDTH">
-                                      <shadow type="math_number" id="+P`sA8CYu5I_.PDO0BrS">
-                                        <field name="NUM">320</field>
-                                      </shadow>
-                                      <block type="ai_model_card_get" id="ag+?C:MYK{*rf{I;4f,b">
-                                        <field name="TYPE">2</field>
-                                      </block>
-                                    </value>
-                                    <value name="HEIGHT">
-                                      <shadow type="math_number" id="Ma}ZF1@vodsBAMA,yrAV">
-                                        <field name="NUM">240</field>
-                                      </shadow>
-                                      <block type="ai_model_card_get" id="0QqnyG}^:Rnqn:NXQXDv">
-                                        <field name="TYPE">3</field>
-                                      </block>
-                                    </value>
-                                  </block>
-                                </value>
-                                <value name="COLOR">
-                                  <block type="lcd_set_color" id="9SFCz6v[TQyFo2G$EC}V">
-                                    <field name="COLOR">#ff0000</field>
-                                  </block>
-                                </value>
-                                <next>
-                                  <block type="ai_lcd_textcarvas" id="%yXQJC0@Pei2^qhA]NEj">
-                                    <field name="varitem">img_card_recognition</field>
-                                    <value name="POSA">
-                                      <block type="lcd_set_position" id="}Kx:v]r.~]23k(L=15Ed" inline="false">
-                                        <value name="POSX">
-                                          <shadow type="math_number" id="fFgjm8!2gG16,:XSR]a0">
-                                            <field name="NUM">0</field>
-                                          </shadow>
-                                          <block type="ai_model_card_get" id=":J5(=|~sphJWG9-U{_*T">
-                                            <field name="TYPE">X</field>
-                                          </block>
-                                        </value>
-                                        <value name="POSY">
-                                          <shadow type="math_number" id="3}O[c$jDPgF/{yXh.?Kc">
-                                            <field name="NUM">0</field>
-                                          </shadow>
-                                          <block type="ai_model_card_get" id="Cvx%S2yX1V}|:9xQs*%.">
-                                            <field name="TYPE">Y</field>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="CONTENT">
-                                      <shadow type="text" id="K?Las_n6^8X}oZ3*7}fj">
-                                        <field name="TEXT"></field>
-                                      </shadow>
-                                      <block type="text_join" id="UX,m2O2@QToK1PChzj0X">
-                                        <mutation items="1"></mutation>
-                                        <value name="ADD0">
-                                          <block type="ai_model_card_get" id="`}n#m_HKV#|Li=`Z1P2L">
-                                            <field name="TYPE">Object</field>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="COLOR">
-                                      <block type="lcd_set_color" id="^2@@e}x@:sMaK%;3b3y5">
-                                        <field name="COLOR">#ffffff</field>
-                                      </block>
-                                    </value>
-                                    <value name="Scale">
-                                      <shadow type="math_number" id="],aZ]ur}ek{6K4*OFx{I">
-                                        <field name="NUM">1</field>
-                                      </shadow>
-                                    </value>
-                                  </block>
-                                </next>
-                              </block>
-                            </statement>
-                          </block>
-                        </statement>
-                        <next>
-                          <block type="ai_lcd_showcarvas_set_display" id="JX:Wp@oAZ+Ib41=Dzk|7">
-                            <field name="varitem">img_card_recognition</field>
-                          </block>
-                        </next>
-                      </block>
+                      <block type="ai_lcd_showcarvas_set_display" id="G53S9xg,q:=U=lWRg95p"></block>
                     </next>
                     </next>
                   </block>
                   </block>
                 </next>
                 </next>
               </block>
               </block>
-            </statement>
+            </next>
           </block>
           </block>
-        </next>
+        </statement>
       </block>
       </block>
     </next>
     </next>
   </block>
   </block>