Skip to content

Commit fd87af7

Browse files
RaymondCMfacebook-github-bot
authored andcommitted
Initialise crop_gen in dataset mapper prior to tfm_gens so logs are c… (facebookresearch#207)
Summary: …lear Before no evidence was in the logs that crop_gen would occur before. Small aesthetic improvement. Purely additive PR. Pull Request resolved: facebookresearch#207 Differential Revision: D18255481 Pulled By: ppwwyyxx fbshipit-source-id: 3186656e8ae53d7a44ea8371db71b41cffcafe56
1 parent 9ac65ae commit fd87af7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

detectron2/data/dataset_mapper.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
22
import copy
3+
import logging
4+
35
import numpy as np
46
import torch
57
from fvcore.common.file_io import PathManager
@@ -30,13 +32,14 @@ class DatasetMapper:
3032
"""
3133

3234
def __init__(self, cfg, is_train=True):
33-
self.tfm_gens = utils.build_transform_gen(cfg, is_train)
34-
3535
if cfg.INPUT.CROP.ENABLED and is_train:
3636
self.crop_gen = T.RandomCrop(cfg.INPUT.CROP.TYPE, cfg.INPUT.CROP.SIZE)
37+
logging.getLogger(__name__).info("CropGen used in training: " + str(self.crop_gen))
3738
else:
3839
self.crop_gen = None
3940

41+
self.tfm_gens = utils.build_transform_gen(cfg, is_train)
42+
4043
# fmt: off
4144
self.img_format = cfg.INPUT.FORMAT
4245
self.mask_on = cfg.MODEL.MASK_ON

0 commit comments

Comments
 (0)