Image Classification Based on Squeezenet
1. Configure Docker development environment
Refer to here. After configuring the Docker development environment, return here to continue the next step.
If you are using a configured Docker development environment, please make sure to follow the Docker configuration tutorial to execute command source ./tpu-mlir/envsetup.sh after starting Docker, otherwise errors may occur in subsequent steps.
2. Prepare the working directory in Docker
Create and enter the squeezenet1.1 working directory, note that it is a directory at the same level as tpu-mlir.
# mkdir squeezenet1.1 && cd squeezenet1.1
Get the original model
# wget https://media.githubusercontent.com/media/onnx/models/main/validated/vision/classification/squeezenet/model/squeezenet1.1-7.tar.gz
Extract squeezenet1.1-7.tar.gz
# tar -zxvf squeezenet1.1-7.tar.gz
After extraction is complete, the squeezenet1.1 folder will be generated in the current directory, which contains the squeezenet1.1.onnx model file.
Copy test image:
# cp -rf ${TPUC_ROOT}/regression/dataset/ILSVRC2012/ .
# cp -rf ${TPUC_ROOT}/regression/image/ .
${TPUC_ROOT} here is an environment variable, corresponding to the tpu-mlir directory, which is loaded in the source ./tpu-mlir/envsetup.sh step in the previous configuration of the Docker development environment.
Create and enter the work working directory to store compiled files such as MLIR and cvimodel
# mkdir work && cd work