conansherry / detectron2

detectron2 windows build
Apache License 2.0
223 stars 54 forks source link

compiled successfully but no attribute named get_config_file #15

Open akshay772 opened 4 years ago

akshay772 commented 4 years ago

Screenshot from 2020-06-19 13-28-22

sainatarajan commented 4 years ago

Try this:

cfg = get_cfg()
cfg.DATASETS.TRAIN = ("wheat_train",)
cfg.DATASETS.TEST = ()
cfg.DATALOADER.NUM_WORKERS = 2

cfg.MODEL.META_ARCHITECTURE= 'GeneralizedRCNN'
cfg.MODEL.BACKBONE.NAME= 'build_resnet_fpn_backbone'
cfg.MODEL.RESNETS.OUT_FEATURES= ["res2", "res3", "res4", "res5"]
cfg.MODEL.FPN.IN_FEATURES= ["res2", "res3", "res4", "res5"]
cfg.MODEL.ANCHOR_GENERATOR.SIZES= [[32], [64], [128], [256], [512]]
cfg.MODEL.ANCHOR_GENERATOR.ASPECT_RATIOS= [[0.5, 1.0, 2.0]]
cfg.MODEL.RPN.IN_FEATURES= ["p2", "p3", "p4", "p5", "p6"]
cfg.MODEL.RPN.PRE_NMS_TOPK_TRAIN= 2000
cfg.MODEL.RPN.PRE_NMS_TOPK_TEST= 1000
cfg.MODEL.RPN.POST_NMS_TOPK_TRAIN= 1000
cfg.MODEL.RPN.POST_NMS_TOPK_TEST= 1000
cfg.MODEL.ROI_HEADS.NAME= 'StandardROIHeads'
cfg.MODEL.ROI_HEADS.IN_FEATURES= ["p2", "p3", "p4", "p5"]
cfg.MODEL.ROI_BOX_HEAD.NAME= 'FastRCNNConvFCHead'
cfg.MODEL.ROI_BOX_HEAD.NUM_FC= 2
cfg.MODEL.ROI_BOX_HEAD.POOLER_RESOLUTION= 7
cfg.MODEL.ROI_MASK_HEAD.NAME= 'MaskRCNNConvUpsampleHead'
cfg.MODEL.ROI_MASK_HEAD.NUM_CONV= 4
cfg.MODEL.ROI_MASK_HEAD.POOLER_RESOLUTION= 14
cfg.MODEL.MASK_ON= False
cfg.MODEL.RESNETS.DEPTH= 101
cfg.SOLVER.IMS_PER_BATCH = 2
cfg.SOLVER.BASE_LR = 0.00025
cfg.SOLVER.MAX_ITER = 20000
cfg.SOLVER.STEPS= (60000, 80000)
cfg.INPUT.MIN_SIZE_TRAIN= (640, 672, 704, 736, 768, 800)
cfg.VERSION= 2

cfg.MODEL.ROI_HEADS.BATCH_SIZE_PER_IMAGE = 512
cfg.MODEL.ROI_HEADS.NUM_CLASSES = 1  # only has one class (Wheat)

os.makedirs(cfg.OUTPUT_DIR, exist_ok=True)
trainer = DefaultTrainer(cfg)
trainer.resume_or_load(resume=False)
trainer.train()
yeeunsong commented 4 years ago

@akshay772 did you solve this problem? having the same problem with you. When I checked the 'init.py' and 'model_zoo.py' file in detectron2/model_zoo directory, the code in this repository and the official facebook repository was different.

This repo's init.py:

from .model_zoo import get, ModelZooUrls

Official facebook repo's init.py:

from .model_zoo import get, get_config_file, get_checkpoint_url

__all__ = ["get_checkpoint_url", "get", "get_config_file"]

You can see that there is no get_checkpoint_url and get_config_file function in this repo's implementation