Frank
June 13, 2022, 1:33am
21
@enggsajjad
Please use the least version with SDK
#!/bin/bash
#NAME=mobilenet_tf
NAME=yolov3
ACUITY_PATH=../bin/
pegasus=${ACUITY_PATH}pegasus
if [ ! -e "$pegasus" ]; then
pegasus=${ACUITY_PATH}pegasus.py
fi
#Tensorflow
#$pegasus import tensorflow \
# --model ./model/mobilenet_v1.pb \
# --inputs input \
# --outputs MobilenetV1/Predictions/Reshape_1 \
# --input-size-list '224,224,3' \
# --output-data ${NAME}.data \
# --output-model ${NAME}.json
#generate inpumeta --source-file dataset.txt
#$pegasus generate inputmeta \
# --model ${NAME}.json \
# --input-meta-output ${NAME}_inputmeta.yml \
# --channel-mean-value "128 128 128 0.0078125" \
# --source-file dataset.txt
#Darknet
$pegasus import darknet\
--model ${NAME}.cfg \
--weights ${NAME}.weights \
--output-model ${NAME}.json \
--output-data ${NAME}.data
$pegasus generate inputmeta \
--model ${NAME}.json \
--input-meta-output ${NAME}_inputmeta.yml \
--channel-mean-value "0 0 0 0.003906" \
--source-file dataset.txt
Using these settings with the new image and recent sdk, the yolov3 worked for me while using following cfg and weights:
https://github.com/yan-wyb/models-zoo/blob/master/darknet/yolov3/yolov3/yolov3.cfg
https://pjreddie.com/media/files/yolov3.weights
while it is not working the cfg and weights from:
git clone https://github.com/pjreddie/darknet
wget https://pjreddie.com/media/files/yolov3.weights
Frank
June 14, 2022, 12:50am
23
So doesn’t this solve your problem? You can compare the differences between the cfg files
Yes, the problem is solved with the cfg and weights you provided.
should I use the these values for:
Yolo-v3 while using cfg and weights from (
GitHub - pjreddie/darknet: Convolutional Neural Networks and https://pjreddie.com/media/files/yolov3.weights ).
Yolo-Tiny while using the above cfg and weights.
Yolo-Tiny while using the cfg and weights you provided.
Please guide which values I should use for the parameter –channel-mean-value for Yolo-v3, and Yolo-Tiny for different cfg/weights.
@Frank , @numbqq
Thanks
For cfg and weights from GitHub - pjreddie/darknet: Convolutional Neural Networks and https://pjreddie.com/media/files/yolov3.weights ).
My scripts are:
0_import_model_608A.sh
#!/bin/bash
NAME=yolov3
ACUITY_PATH=../bin/
pegasus=${ACUITY_PATH}pegasus
if [ ! -e "$pegasus" ]; then
pegasus=${ACUITY_PATH}pegasus.py
fi
$pegasus import darknet\
--model /home/sajjad/sajjad/darknet/cfg/yolov3.cfg \
--weights /home/sajjad/sajjad/darknet/yolov3.weights \
--output-model ${NAME}.json \
--output-data ${NAME}.data \
$pegasus generate inputmeta \
--model ${NAME}.json \
--input-meta-output ${NAME}_inputmeta.yml \
--channel-mean-value "0 0 0 0.003906" \
--source-file data/validation_tf_608.txt
1_quantize_model_608.sh
#!/bin/bash
NAME=yolov3
ACUITY_PATH=../bin/
pegasus=${ACUITY_PATH}pegasus
if [ ! -e "$pegasus" ]; then
pegasus=${ACUITY_PATH}pegasus.py
fi
$pegasus quantize \
--quantizer dynamic_fixed_point \
--qtype int8 \
--rebuild \
--with-input-meta ${NAME}_inputmeta.yml \
--model ${NAME}.json \
--model-data ${NAME}.data
2_export_case_code_608.sh
#!/bin/bash
NAME=yolov3
ACUITY_PATH=../bin/
pegasus=$ACUITY_PATH/pegasus
if [ ! -e "$pegasus" ]; then
pegasus=$ACUITY_PATH/pegasus.py
fi
$pegasus export ovxlib\
--model ${NAME}.json \
--model-data ${NAME}.data \
--model-quantize ${NAME}.quantize \
--with-input-meta ${NAME}_inputmeta.yml \
--dtype quantized \
--optimize VIPNANOQI_PID0X88 \
--viv-sdk ${ACUITY_PATH}vcmdtools \
--pack-nbg-unify
This gives the wrong result for Yolo-V3.
Result (wrong):
khadas@Khadas:~/hussain/standalone_initial/newscripts/sample_demo_x11B/bin_r_cv4$ ./detect_demo_x11 -m 2 -w 608 -h 608 -p ~/hussain/img/608/person_608.jpg
det_set_log_config Debug
det_set_model success!!
model.width:608
model.height:608
model.channel:3
Det_set_input START
Det_set_input END
Det_get_result START
--- Top5 ---
32804: 9.750000
32785: 7.500000
32803: 6.750000
32805: 6.250000
32443: 6.000000
Det_get_result END
resultData.detect_num=1
result type is 2
i:1 left:297.166 right:370.855 top:417.737 bottom:608
Can you please guide, what is wrong here? Thanks
@Frank @numbqq
Frank
July 8, 2022, 1:02am
27
@enggsajjad
The post-processing functions of yolo tiny and yolo are different. In most cases, the problem in your picture is caused by the improper processing of the output data by the post-processing function. This part of the code depends on your own exploration, maybe you should understand the structure of the yolo series mode
No, I have not tried yolo-tiny yet. I was asking that if I try to convert the model of yolo-tiny, should I use the same scripts?
The result I showed above, was generated from Yolov3, which is based on model conversion from cfg/weights from darknet official. Which is not working as you see! I am curious that why it is not working? Where should I change in the scripts?
This is important for me before I proceed to yolo-tiny model conversion and using it.
Thanks for the responses!
@Frank
Frank
July 8, 2022, 1:19am
29
I remember I gave you a cfg and weights file that you can use. I’m using a file from 19 years, if the structure of the yolo series changes now, then the post-processing program also needs to do the corresponding processing.
1 Like
Yes, I know that and appreciate your help. May be I am not able to properly explain it.
We are confused and trying to understand that whatever is mentioned on the page convert and call your own model through NPU | Khadas Documentation , is out of date? And it should actually be what we have discussed in this thread. Right?
On last question! If I have to convert the yolo-tiny model, which cfg and weights should I use? Please share if you have the working one.
Thanks alot!
@Frank
Frank
July 8, 2022, 1:34am
31
@enggsajjad
This is my cfg file . The weights file you can get form darknet website.
1 Like
Got it!
--channel-mean-value "0 0 0 0.003906"
will remain the same for yolo-tiny model convesion in 0_import_model.sh?
I will run and share with you.
Thanks alot! Regards
Frank
July 8, 2022, 2:01am
33
@enggsajjad All my yolo demo use same parameters.
1 Like