Skip to content

Commit

Permalink
multi-scale detection, first pass low-res, second pass hi-res
Browse files Browse the repository at this point in the history
  • Loading branch information
cquest committed Jul 17, 2023
1 parent c40f99f commit 7103136
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/blur/blur.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,27 @@ def blurPicture(picture, keep):
jpg.read())
jpg.seek(0)

if width>=3840:
# call our detection model and dispatch threads on GPUs
# call our detection model and dispatch threads on GPUs
try:
results = model.predict(source=tmp,
conf=0.05,
imgsz=min(int(width) >> 5 << 5,8192),
device=[gpu])
result = [results[0]]
offset = [[0,0]]
else:
# call our detection model and dispatch threads on GPUs
except:
return None,None
result = [results[0]]
offset = [[0,0]]

if width>=3840:
# detect again at higher resolution for smaller objects
try:
results = model.predict(source=tmp,
conf=0.05,
device=[gpu])
conf=0.05,
imgsz=min(int(width) >> 5 << 5,8192),
device=[gpu])
except:
return None,None
result = [results[0]]
offset = [[0,0]]
result.append(results[0])
offset.append([0,0])

info = []
salt = None
Expand Down

0 comments on commit 7103136

Please sign in to comment.