mAP test SOP with SNNF
This document is an example of using YOLOV8s object detection to test model mean average precision(mAP) on C3V.
1. Prepare the environment (on Ubuntu)
sudo apt update
sudo apt install python3-pip libopencv-dev libjsoncpp-dev
pip install pycocotools
2. Cross-compile the sample (on Ubuntu)
First, you need to use the snnf_build.sh script to compile the SNNF-related library files, and then execute the following command:
make -C unittest/mapTest/ && make install
After the command execution is completed, the following log can be seen:
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
total 444
-rwxr-xr-x 1 c3v c3v 118528 Jan 8 17:10 snnf_map_demo
-rwxr-xr-x 1 c3v c3v 332096 Jan 8 17:10 snnf_nnsample
---------------------------------------------------------------------------------
install
---------------------------------------------------------------------------------
total 36
drwxr-xr-x 2 c3v c3v 4096 Jan 8 17:10 bin
drwxr-xr-x 6 c3v c3v 4096 Jan 8 17:10 include
drwxr-xr-x 3 c3v c3v 4096 Jan 8 16:54 lib
drwxr-xr-x 7 c3v c3v 4096 Jan 8 17:10 resource
drwxr-xr-x 4 c3v c3v 4096 Jan 8 17:10 samples
-rwxr-xr-x 1 c3v c3v 473 Jan 8 17:10 snnf_build_samples.sh
-rwxr-xr-x 1 c3v c3v 1618 Jan 8 17:10 snnf_env.sh
-rwxr-xr-x 1 c3v c3v 430 Jan 8 17:10 snnf_run.sh
drwxr-xr-x 9 c3v c3v 4096 Jan 8 17:10 thirdparty
---------------------------------------------------------------------------------
the snnf_map_demo app was built completely, which is in the following path: release/bin/
The release code tree is like this:
3. Inference(on C3V)
Please prepare the coco dataset: 2017 Val images [5K/1GB] COCO - Common Objects in Context
Copy the whole release folder to the C3V, and copy the val2017 dataset to the C3V. Do the map test using the following command:
snnf_map_demo needs to set two parameters.
param1: the dataset path of coco val2017.
param2: result file name, the detects results by yolov8s object detection.
After the command execution is completed, the following log can be seen:
4. Evaluation(on Ubuntu)
Download the file and unzip it to the Ubuntu. The coco_eval.zip has two files:
coco_eval.py
instances_val2017.json
Copy the detection_results_coco_val2017.json to Ubuntu.
Use coco_eval.py to evaluate:
The results are like this: