The model file usually contains the parameters and weight information of the neural network architecture and is the result of the neural network training process. For K210, the model can be used for various machine learning tasks such as face detection, mask recognition, face recognition, and object recognition. Due to the limited resources of the K210 chip, the trained model needs to be transferred to the TF card for storage. The suffix of the model file is .kmodel.
There are two ways to transfer the model file to the TF card. The first way is to use a card reader. Insert the TF card into the card reader. The card reader is inserted into the USB port of the computer. Download the compressed model file package in the data and decompress it. Copy the folder to the root directory of the H: drive.
Method 1 can import all model files at once, eliminating the need to import model files each time, and load model files using different paths. All model files are placed in the KPU folder. Please do not modify KPU and the file names under the KPU directory, otherwise the default routine program will not be able to find the model files.
The second method is to import the model file through CanMV IDE without using a card reader. Here we take importing landmark68.kmodel as an example and connect the K210 module to the computer USB port through a microUSB data cable. Then click the connect button in the lower left corner of CanMV IDE. If the connection is successful, the icon will change to the connected state, and the gray play button will turn green.
Open Tools->Save file to CanMV Cam.
Click Open, then select the model file to be imported and transfer it to the memory card.
Note: The files written here are written to the memory card first. Please delete the file path when saving. Saving with a path is likely to result in an error.
When running the code, the specific saved model path shall prevail. If you follow the first method of this tutorial, the default code will be used without modification.
If you follow the second method of this tutorial, you need to delete the redundant paths in the program, that is, only keep the prefix /sd/.