Skip to content

Commit

Permalink
replaced opencv with imagesize fixes #530
Browse files Browse the repository at this point in the history
  • Loading branch information
cansik committed Dec 30, 2023
1 parent 226d8cc commit e6acae8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 4 additions & 5 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 @@ -53,8 +53,8 @@ def __init__(self, class_names, **kwargs):

@staticmethod
def _find_image(
image_prefix: str,
image_types: Sequence[str] = (".png", ".jpg", ".jpeg", ".bmp", ".tiff"),
image_prefix: str,
image_types: Sequence[str] = (".png", ".jpg", ".jpeg", ".bmp", ".tiff"),
) -> Optional[str]:
for image_type in image_types:
path = f"{image_prefix}{image_type}"
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
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

0 comments on commit e6acae8

Please sign in to comment.