Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
[fix] Some imports and add check when PIL cannot read images from a f…
Browse files Browse the repository at this point in the history
…older
  • Loading branch information
vedanuj committed May 9, 2020
1 parent 0e619eb commit 163daea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions grid_feats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .build_loader import (
build_detection_train_loader_with_attributes,
build_detection_test_loader_with_attributes,
build_detection_test_loader_for_images,
)
from .roi_heads import AttributeRes5ROIHeads, AttributeStandardROIHeads
from . import visual_genome
2 changes: 1 addition & 1 deletion grid_feats/build_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from detectron2.data.build import get_detection_dataset_dicts, worker_init_reset_seed, trivial_batch_collator
from detectron2.data.common import AspectRatioGroupedDataset, DatasetFromList, MapDataset

from .dataset_mapper import AttributeDatasetMapper
from .dataset_mapper import AttributeDatasetMapper, TestDatasetMapper


def build_detection_train_loader_with_attributes(cfg, mapper=None):
Expand Down
7 changes: 5 additions & 2 deletions grid_feats/dataset_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,11 @@ def __init__(self, cfg, is_train=False):

def __call__(self, dataset_dict):
dataset_dict = copy.deepcopy(dataset_dict)
image = utils.read_image(dataset_dict["file_name"], format=self.img_format)
utils.check_image_size(dataset_dict, image)
try:
image = utils.read_image(dataset_dict["file_name"], format=self.img_format)
utils.check_image_size(dataset_dict, image)
except OSError:
return

if "annotations" not in dataset_dict:
image, transforms = T.apply_transform_gens(
Expand Down

0 comments on commit 163daea

Please sign in to comment.