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

Replaced opencv with imagesize to get the actual image size #548

Merged
merged 3 commits into from
Jan 8, 2024
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
5 changes: 2 additions & 3 deletions nanodet/data/dataset/yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from collections import defaultdict
from typing import Optional, Sequence

import cv2
import numpy as np
from imagesize import imagesize
from pycocotools.coco import COCO

from .coco import CocoDataset
Expand Down Expand Up @@ -92,8 +92,7 @@ def yolo_to_coco(self, ann_path):
with open(ann_file, "r") as f:
lines = f.readlines()

image = cv2.imread(image_file)
height, width = image.shape[:2]
width, height = imagesize.get(image_file)

file_name = os.path.basename(image_file)
info = {
Expand Down
2 changes: 1 addition & 1 deletion nanodet/model/arch/one_stage_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def inference(self, meta):
time2 = time.time()
print("forward time: {:.3f}s".format((time2 - time1)), end=" | ")
results = self.head.post_process(preds, meta)

if is_cuda_available:
torch.cuda.synchronize()

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Cython
imagesize
matplotlib
numpy
omegaconf>=2.0.1
Expand Down
Loading