heyongxin233 / YOLO-Pruning-RKNN

Easy Training Official YOLOv8、YOLOv7、YOLOv6、YOLOv5 and Prune all_model using Torch-Pruning!
45 stars 6 forks source link

error evaluating the pruned model #3

Open melika-sce opened 10 months ago

melika-sce commented 10 months ago

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

melika-sce commented 10 months ago

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!

heyongxin233 commented 10 months ago

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