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

Fix exception #183

Merged
merged 3 commits into from
Oct 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 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