diff --git a/nanodet/data/dataset/yolo.py b/nanodet/data/dataset/yolo.py index 6c5efff40..f6b75b986 100644 --- a/nanodet/data/dataset/yolo.py +++ b/nanodet/data/dataset/yolo.py @@ -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 @@ -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 = { diff --git a/nanodet/model/arch/one_stage_detector.py b/nanodet/model/arch/one_stage_detector.py index 90aa3f6f3..8a0f61a81 100644 --- a/nanodet/model/arch/one_stage_detector.py +++ b/nanodet/model/arch/one_stage_detector.py @@ -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() diff --git a/requirements.txt b/requirements.txt index 4f88e6515..d1a281b11 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ Cython +imagesize matplotlib numpy omegaconf>=2.0.1