heyongxin233/YOLO-Pruning-RKNN

error evaluating the pruned model

Opened this issue · 2 comments

Hi, thanks for this good repo, I wonder how can I load the pruned model with YOLOv8?
when I try to run the below command to get the validation results and GFLOP and number of layers, I get this error:
command:
yolo task=detect mode=val batch=1 model=YOLO-Pruning-RKNN/runs/detect/yolov8m_Prune50%/weights/best.pt imgsz=1024 data=VisDrone.yaml save_json=True

error:
return F.conv2d(input, weight, bias, self.stride, RuntimeError: Given groups=1, weight of size [24, 24, 3, 3], expected input[1, 12, 256, 256] to have 24 channels, but got 12 channels instead

well, it was solved by making a val.py file with below codes:

from ultralytics import YOLO
model = YOLO('prune_model.pt')
metrics = model.val()

but I still don't know how to get FLOPs of pruned model, any help would be appreciated!

Thank you for your interest in my repo!You can refer to the calculate.py file to get the model Macs.