Skip to content

Detectron2 Custom Object Detection + Sahi #927

Answered by HauCongNguyen
drdoof2019 asked this question in Q&A
Discussion options

You must be logged in to vote

You can add the following code to the detectron2 config, and you will get config.yaml file. The config_path is the path to config.yaml :
from sahi.utils.detectron2 import export_cfg_as_yaml
export_cfg_as_yaml(cfg, export_path='config.yaml')


Ex:

cfg = get_cfg()

cfg.merge_from_file(model_zoo.get_config_file("COCO-Detection/faster_rcnn_R_50_FPN_3x.yaml"))
cfg.DATASETS.TRAIN = ("",)
cfg.DATASETS.TEST = ("",)
cfg.DATALOADER.NUM_WORKERS = 2
.............
cfg.SOLVER.GAMMA = 0.05
cfg.MODEL.ROI_HEADS.BATCH_SIZE_PER_IMAGE = 64
cfg.MODEL.ROI_HEADS.NUM_CLASSES = 1

cfg.TEST.EVAL_PERIOD=500

#export config.yaml
from sahi.utils.detectron2 import export_cfg_as_yaml
export_cfg_as_yaml(cfg, export_path='co…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@drdoof2019
Comment options

@HauCongNguyen
Comment options

Answer selected by fcakyon
@hkeay
Comment options

@HauCongNguyen
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants