Paperspace/DataAugmentationForObjectDetection

Crop Video frames

manza-ari opened this issue · 1 comments

Hi @bbatha @weikaolun @kossak @dte @soliton4

Kindly guide how to crop images detected by the object detection method YOLO v3

I have a video file which I have converted in frames with bounding boxes.

Hi @bbatha @weikaolun @kossak @dte @soliton4

Kindly guide how to crop images detected by the object detection method YOLO v3

I have a video file which I have converted in frames with bounding boxes.

Update your code in detect.py

if save_img or save_crop or view_img: # Add bbox to image
c = int(cls) # integer class
label = None if hide_labels else (names[c] if hide_conf else f'{names[c]} {conf:.2f}')
annotator.box_label(xyxy, label, color=colors(c, True))
save_one_box(xyxy, imc, file=save_dir / 'crops' / names[c] / f'{p.stem}.jpg', BGR=True) #this line will crop image frame video