@nina-vilela
This is my scripts for compile custom retrained yolov8n model
(Input size=1280x1280, Classes=6, DFCversion=3.27.0)
# custom_yolov8n.yaml
base:
- base/yolov8.yaml
postprocessing:
device_pre_post_layers:
nms: true
hpp: true
network:
network_name: yolov8n
paths:
alls_script: custom_yolov8n.alls
parser:
nodes:
- null
- - /model.22/cv2.0/cv2.0.2/Conv
- /model.22/cv3.0/cv3.0.2/Conv
- /model.22/cv2.1/cv2.1.2/Conv
- /model.22/cv3.1/cv3.1.2/Conv
- /model.22/cv2.2/cv2.2.2/Conv
- /model.22/cv3.2/cv3.2.2/Conv
quantization:
calib_set:
- models_files/my_dataset/adm_bbox_v2_calib_8000.tfrecord
preprocessing:
network_type: detection
input_shape:
- 1280
- 1280
- 3
meta_arch: yolo_v5
padding_color: 114
.
# custom_yolov8n.alls
normalization1 = normalization([0.0, 0.0, 0.0], [255.0, 255.0, 255.0])
model_optimization_flavor(optimization_level=4)
change_output_activation(conv42, sigmoid)
change_output_activation(conv53, sigmoid)
change_output_activation(conv63, sigmoid)
performance_param(compiler_optimization_level=max)
nms_postprocess("../../postprocess_config/custom_yolov8n_nms_config_1280.json", meta_arch=yolov8, engine=cpu)
model_optimization_config(calibration, batch_size=16, calibset_size=8000)
post_quantization_optimization(finetune, policy=enabled, dataset_size=8000, epochs=8, learning_rate=0.0001)
.
# custom_yolov8n_nms_config_1280.json
{
"nms_scores_th": 0.2,
"nms_iou_th": 0.7,
"image_dims": [
1280,
1280
],
"max_proposals_per_class": 100,
"classes": 6,
"regression_length": 16,
"background_removal": false,
"bbox_decoders": [
{
"name": "yolov8n/bbox_decoder41",
"stride": 8,
"reg_layer": "yolov8n/conv41",
"cls_layer": "yolov8n/conv42"
},
{
"name": "yolov8n/bbox_decoder52",
"stride": 16,
"reg_layer": "yolov8n/conv52",
"cls_layer": "yolov8n/conv53"
},
{
"name": "yolov8n/bbox_decoder62",
"stride": 32,
"reg_layer": "yolov8n/conv62",
"cls_layer": "yolov8n/conv63"
}
]
}
So by compiling the above script, I was able to get a maximum mAP50 score of 0.65.
Now, I’m trying to optimize with full-16-bit and add this solutions as you recommanded.