Open anirbansen2709 opened 4 years ago
should use the current codebase. We define several hyper-parameters, including radix. #14
over here directly add path file. Do this cfg.MODEL.WEIGHTS = "https://hangzh.s3-us-west-1.amazonaws.com/encoding/models/resnest200_detectron-02644020.pth"
instead of cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url("COCO-Detection/faster_cascade_rcnn_ResNeSt_50_FPN_syncbn_range-scale-1x.yaml")
Open this file aster_cascade_rcnn_ResNeSt_50_FPN_syncbn_range-scale-1x.yaml. copy path of weights file add paste it directly
HI how to directly inference through demo.py e.g.
!python -W ignore demo/demo.py \ --config-file mask_cascade_rcnn_ResNeSt_200_FPN_dcn_syncBN_all_tricks_3x.yaml \ --input "2.jpg"\ --output "out.jpg" \ --confidence-threshold 0.3 \ --opts MODEL.WEIGHTS detectron2-ResNeSt/resnest200_detectron-02644020.pth
this command stiill return the KeyError: 'Non-existent config key: MODEL.RESNETS.RADIX'
HI how to directly inference through demo.py e.g.
!python -W ignore demo/demo.py --config-file mask_cascade_rcnn_ResNeSt_200_FPN_dcn_syncBN_all_tricks_3x.yaml --input "2.jpg" --output "out.jpg" --confidence-threshold 0.3 --opts MODEL.WEIGHTS detectron2-ResNeSt/resnest200_detectron-02644020.pth
this command stiill return the KeyError: 'Non-existent config key: MODEL.RESNETS.RADIX'
不要使用这个指令 [pip install detectron2==0.1.3 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu101/torch1.5/index.html], 我使用了这个,运行没问题 [python -m pip install 'git+https://github.com/zhanghang1989/detectron2-ResNeSt.git'],如果已经安装了detectron2,先用pip uninstall 卸载,估计这样没问题了。
should use the current codebase. We define several hyper-parameters, including radix. #14
The #14 page not found?
Following the steps @ravising-h pointed out returns empty tensors when performing inference. I used the following code:
cfg = get_cfg()
cfg.merge_from_file('./configs/COCO-InstanceSegmentation/mask_cascade_rcnn_ResNeSt_200_FPN_dcn_syncBN_all_tricks_3x.yaml')
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5 # set threshold for this model
cfg.MODEL.WEIGHTS = "https://s3.us-west-1.wasabisys.com/resnest/detectron/resnest200_detectron-02644020.pth"
predictor = DefaultPredictor(cfg)
outputs = predictor(im)
print(outputs["instances"].pred_classes)
print(outputs["instances"].pred_boxes)
But returns the following:
tensor([], device='cuda:0', dtype=torch.int64)
Boxes(tensor([], device='cuda:0', size=(0, 4)))
Hence, there is no generated mask:
Any idea why this might be happening?
❓ I'm using the official colab notebook
https://colab.research.google.com/drive/16jcaJoc6bCFAQ96jDe2HwtXj7BMD_-m5
but how do I add the config for ReNeSt
from detectron2.engine import DefaultTrainer from detectron2.config import get_cfg
cfg = get_cfg() cfg.merge_from_file("COCO-Detection/faster_cascade_rcnn_ResNeSt_50_FPN_syncbn_range-scale-1x.yaml") cfg.DATASETS.TRAIN = ("my_dataset_train",) cfg.DATASETS.TEST = () cfg.DATALOADER.NUM_WORKERS = 2 cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url("COCO-Detection/faster_cascade_rcnn_ResNeSt_50_FPN_syncbn_range-scale-1x.yaml") # Let training initialize from model zoo cfg.SOLVER.IMS_PER_BATCH = 2 cfg.SOLVER.BASE_LR = 0.00025 # pick a good LR cfg.SOLVER.MAX_ITER = 300 # 300 iterations seems good enough for this toy dataset; you may need to train longer for a practical dataset cfg.MODEL.ROI_HEADS.BATCH_SIZE_PER_IMAGE = 128 # faster, and good enough for this toy dataset (default: 512) cfg.MODEL.ROI_HEADS.NUM_CLASSES = 1 # only has one class (ballon)
os.makedirs(cfg.OUTPUT_DIR, exist_ok=True) trainer = DefaultTrainer(cfg) trainer.resume_or_load(resume=False) trainer.train()
This doesnt seem to work and gives following error AssertionError: Config file 'COCO-Detection/faster_cascade_rcnn_ResNeSt_50_FPN_syncbn_range-scale-1x.yaml' does not exist!