Skip to content

Commit

Permalink
pathlib.PosixPath support
Browse files Browse the repository at this point in the history
  • Loading branch information
MiXaiLL76 committed Aug 28, 2024
1 parent b373242 commit 697204d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions faster_coco_eval/core/coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import json
import logging
import os
import pathlib
import time
import warnings
from collections import defaultdict
Expand All @@ -25,7 +26,9 @@ def _isArrayLike(obj):
class COCO:
def __init__(
self,
annotation_file: Optional[Union[str, dict, os.PathLike]] = None,
annotation_file: Optional[
Union[str, dict, os.PathLike, pathlib.PosixPath]
] = None,
use_deepcopy: bool = False,
):
"""Constructor of Microsoft COCO helper class.
Expand All @@ -51,7 +54,7 @@ def __init__(
if annotation_file is not None:
self._print_function("loading annotations into memory...")
tic = time.time()
if type(annotation_file) in [str, os.PathLike]:
if type(annotation_file) in [str, os.PathLike, pathlib.PosixPath]:
self.dataset = self.load_json(annotation_file)
elif type(annotation_file) is dict:
if self.use_deepcopy:
Expand Down

0 comments on commit 697204d

Please sign in to comment.