1000 object classification models

    Can recognize 1000 objects


    • Use minimum version firmware
    • Download model file, download mobilenet_0x300000.kfpkg
    • Use kflash_gui to burn this file to Flash, the default address is 0x300000
    • Save the file labels.txt (Alternate Link) to the file system, see the introductory tutorial (use your ingenuity) for specific methods (reference answer: because there is too much content, if you use the REPL to copy and paste directly, data may be wrong. So use a tool to transfer. The easiest way is to put it on the SD card; if you want to put it in /flash, the minimum may not support IDE, you can use upyloader to send files)
    • Because this model has 4.2MiB, which is relatively large, so the firmware of minimum is used, and the memory used by GC is not too large. You can set a smaller size in the following way and leave the memory for the model
    from Maix import utils
    import machine
    • Import model
    import KPU as kpu
    task = kpu.load(0x300000)
    • Read in labels
    • Initialize the camera, LCD

    You can set whether the camera is mirrored and whether the LCD is rotated according to your own hardware installation

    Slightly, please refer to the previous tutorial

    • Identify objects
    fmap = kpu.forward(task, img)

    Here, the result of the operation is converted into a list object, and then the subscript of the maximum value is found. Through this subscript, we know what the label name is (labels[max_index])

    • show result
    img = img.draw_string(0, 0, "%.2f: %s" %(pmax, labels[max_index].strip()), color=(255, 0, 0))
    lcd.display(img, oft=(0,0))

    See the complete example maixpy_scripts