Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Feature: added cmd line arg for saving only positives #13005

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1bff014
added cmd line arg for saving only positives
GarbageHaus May 12, 2024
5b77e7e
Auto-format by https://ultralytics.com/actions
UltralyticsAssistant May 12, 2024
a1ee719
Merge branch 'master' into patch-1
UltralyticsAssistant May 13, 2024
53d798a
Merge branch 'master' into patch-1
UltralyticsAssistant May 18, 2024
97ce444
Merge branch 'master' into patch-1
UltralyticsAssistant May 24, 2024
f76eeb5
Merge branch 'master' into patch-1
UltralyticsAssistant May 28, 2024
9430afd
Merge branch 'master' into patch-1
UltralyticsAssistant May 29, 2024
c1cc124
Merge branch 'master' into patch-1
UltralyticsAssistant May 29, 2024
2fcfcce
Merge branch 'master' into patch-1
UltralyticsAssistant May 30, 2024
100a59d
Merge branch 'master' into patch-1
UltralyticsAssistant Jun 8, 2024
4389663
Merge branch 'master' into patch-1
UltralyticsAssistant Jun 8, 2024
d25a53c
Merge branch 'master' into patch-1
UltralyticsAssistant Jun 9, 2024
80b97c9
Merge branch 'master' into patch-1
UltralyticsAssistant Jun 16, 2024
49c712c
Merge branch 'master' into patch-1
UltralyticsAssistant Jun 16, 2024
5463f6b
Merge branch 'master' into patch-1
UltralyticsAssistant Jun 17, 2024
153a254
Merge branch 'master' into patch-1
UltralyticsAssistant Jun 19, 2024
35b1222
Merge branch 'master' into patch-1
UltralyticsAssistant Jun 19, 2024
d81eb84
Merge branch 'master' into patch-1
UltralyticsAssistant Jun 20, 2024
8a12443
Merge branch 'master' into patch-1
UltralyticsAssistant Jun 20, 2024
cff06d2
Merge branch 'master' into patch-1
UltralyticsAssistant Jun 20, 2024
49a3bff
Merge branch 'master' into patch-1
UltralyticsAssistant Jun 20, 2024
2a16344
Merge branch 'master' into patch-1
UltralyticsAssistant Jun 22, 2024
85b713f
Merge branch 'master' into patch-1
UltralyticsAssistant Jun 30, 2024
30ae346
Merge branch 'master' into patch-1
UltralyticsAssistant Jun 30, 2024
707f6e1
Merge branch 'master' into patch-1
UltralyticsAssistant Jun 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def run(
save_conf=False, # save confidences in --save-txt labels
save_crop=False, # save cropped prediction boxes
nosave=False, # do not save images/videos
savepositives=False, # save only positive detections
classes=None, # filter by class: --class 0, or --class 0 2 3
agnostic_nms=False, # class-agnostic NMS
augment=False, # augmented inference
Expand Down Expand Up @@ -233,7 +234,7 @@ def write_to_csv(image_name, prediction, confidence):
cv2.waitKey(1) # 1 millisecond

# Save results (image with detections)
if save_img:
if save_img and ((savepositives and len(det)) or not savepositives):
if dataset.mode == "image":
cv2.imwrite(save_path, im0)
else: # 'video' or 'stream'
Expand Down Expand Up @@ -281,6 +282,7 @@ def parse_opt():
parser.add_argument("--save-conf", action="store_true", help="save confidences in --save-txt labels")
parser.add_argument("--save-crop", action="store_true", help="save cropped prediction boxes")
parser.add_argument("--nosave", action="store_true", help="do not save images/videos")
parser.add_argument("--savepositives", action="store_true", help="save files only with a positive detection")
parser.add_argument("--classes", nargs="+", type=int, help="filter by class: --classes 0, or --classes 0 2 3")
parser.add_argument("--agnostic-nms", action="store_true", help="class-agnostic NMS")
parser.add_argument("--augment", action="store_true", help="augmented inference")
Expand Down