Skip to content

Commit

Permalink
Fix exception (#183)
Browse files Browse the repository at this point in the history
* Fixing exception in `LoadImagesAndLabels`

* Fixing exception in thop importing

* Fixing exception in `exif_size`
  • Loading branch information
zhiqwang authored Oct 2, 2021
1 parent c9b5b6f commit f0746c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions yolort/v5/utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def exif_size(img):
s = (s[1], s[0])
elif rotation == 8: # rotation 90
s = (s[1], s[0])
except KeyError:
except AttributeError:
pass

return s
Expand Down Expand Up @@ -368,7 +368,7 @@ def __init__(
assert cache["version"] == 0.4 and cache["hash"] == get_hash(
self.label_files + self.img_files
)
except AssertionError:
except FileNotFoundError:
cache, exists = self.cache_labels(cache_path, prefix), False # cache

# Display cache
Expand Down
6 changes: 3 additions & 3 deletions yolort/v5/utils/torch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ def profile(input, ops, n=10, device=None):
)
# dt forward, backward
tf, tb, t = 0.0, 0.0, [0.0, 0.0, 0.0]
try:
if thop is None:
flops = 0
else:
# GFLOPs
flops = thop.profile(m, inputs=(x,), verbose=False)[0] / 1e9 * 2
except ImportError:
flops = 0

try:
for _ in range(n):
Expand Down

0 comments on commit f0746c6

Please sign in to comment.