Paperspace / DataAugmentationForObjectDetection

Data Augmentation For Object Detection
https://blog.paperspace.com/data-augmentation-for-bounding-boxes/
MIT License
1.13k stars 318 forks source link

Crop Video frames #10

Open manza-ari opened 5 years ago

manza-ari commented 5 years ago

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.

Piyush-k-singh commented 2 years ago

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