Reputation: 283
I am trying to train a custom model from within the coco dataset just for one class - apple.This is for instance segmentation. I have used some opensource programs to extract the apple images and corresponding json file with the bounding box data etc. The code I have used for training is
from detectron2.data.datasets import register_coco_instances
from detectron2.engine import DefaultTrainer
from detectron2.config import get_cfg
from detectron2.model_zoo import model_zoo
import os
from detectron2.data.datasets import register_coco_instances
from detectron2.data import MetadataCatalog
from detectron2.data import DatasetCatalog
register_coco_instances("train", {}, "segmentation/coco/my_custom_dataset/annotations/coco_annotation.json", "/home/segmentation/coco/my_custom_dataset/images")
register_coco_instances("val", {}, "/home/segmentation/coco/my_custom_dataset_validation/annotations/coco_annotation.json", "/home/segmentation/coco/my_custom_dataset_validation/images")
my_dataset_metadata = MetadataCatalog.get("train")
print(my_dataset_metadata)
dataset_dicts = DatasetCatalog.get("train")
print(dataset_dicts)
#register_coco_instances("my_dataset_validation", {}, "/home/akshay/segmentation/coco/my_custom_dataset/annotations/coco_annotation.json", "/home/akshay/segmentation/coco/my_custom_dataset/images")
cfg = get_cfg()
cfg.merge_from_file(
"../detectron2/configs/COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x.yaml"
)
cfg.DATASETS.TRAIN = ("train",)
cfg.DATASETS.TEST = () # no metrics implemented for this dataset
cfg.DATALOADER.NUM_WORKERS = 2
cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url("COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x.yaml") # initialize from model zoo
cfg.SOLVER.IMS_PER_BATCH = 2
cfg.SOLVER.BASE_LR = 0.001
cfg.SOLVER.MAX_ITER = (
1000
) # 300 iterations seems good enough, but you can certainly train longer
cfg.MODEL.ROI_HEADS.BATCH_SIZE_PER_IMAGE = (
128
) # faster, and good enough for this toy dataset
cfg.MODEL.ROI_HEADS.NUM_CLASSES = 1 # 3 classes (data, fig, hazelnut)
os.makedirs(cfg.OUTPUT_DIR, exist_ok=True)
trainer = DefaultTrainer(cfg)
trainer.resume_or_load(resume=False)
trainer.train()
I have then copied the corresponding model_final.pth file to the detectron2 folder and then run my inference code which is as follows
from detectron2.data import DatasetCatalog, MetadataCatalog, build_detection_test_loader
from detectron2.evaluation import COCOEvaluator, inference_on_dataset
from detectron2.engine import DefaultTrainer
from detectron2.evaluation import COCOEvaluator
import os
from detectron2 import model_zoo
from detectron2.engine import DefaultPredictor
from detectron2.config import get_cfg
from detectron2.utils.visualizer import Visualizer
from detectron2.data import MetadataCatalog
from detectron2.data.catalog import DatasetCatalog
import cv2
cfg = get_cfg()
cfg.MODEL.WEIGHTS = ("model_final.pth")
cfg.DATASETS.TEST = ("validation", )
cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.2 # set the testing threshold for this model
predictor = DefaultPredictor(cfg)
test_metadata = MetadataCatalog.get("validation").set(thing_classes=["apple"])
from detectron2.utils.visualizer import ColorMode
import glob
im = cv2.imread("hi.jpg")
outputs = predictor(im)
v = Visualizer(im[:, :, ::-1],
metadata=test_metadata,
scale=0.8
)
out = v.draw_instance_predictions(outputs["instances"].to("cpu"))
cv2.imwrite("evaluate_output.jpg",out.get_image()[:, :, ::-1])
However, I am not geting the required output with the mask. I am jst getting the same input image back again. This is the output of the code
Skip loading parameter 'proposal_generator.rpn_head.conv.weight' to the model due to incompatible shapes: (256, 256, 3, 3) in the checkpoint but (1024, 1024, 3, 3) in the model! You might want to double check if this is expected.
Skip loading parameter 'proposal_generator.rpn_head.conv.bias' to the model due to incompatible shapes: (256,) in the checkpoint but (1024,) in the model! You might want to double check if this is expected.
Skip loading parameter 'proposal_generator.rpn_head.objectness_logits.weight' to the model due to incompatible shapes: (3, 256, 1, 1) in the checkpoint but (15, 1024, 1, 1) in the model! You might want to double check if this is expected.
Skip loading parameter 'proposal_generator.rpn_head.objectness_logits.bias' to the model due to incompatible shapes: (3,) in the checkpoint but (15,) in the model! You might want to double check if this is expected.
Skip loading parameter 'proposal_generator.rpn_head.anchor_deltas.weight' to the model due to incompatible shapes: (12, 256, 1, 1) in the checkpoint but (60, 1024, 1, 1) in the model! You might want to double check if this is expected.
Skip loading parameter 'proposal_generator.rpn_head.anchor_deltas.bias' to the model due to incompatible shapes: (12,) in the checkpoint but (60,) in the model! You might want to double check if this is expected.
Skip loading parameter 'roi_heads.box_predictor.cls_score.weight' to the model due to incompatible shapes: (2, 1024) in the checkpoint but (81, 2048) in the model! You might want to double check if this is expected.
Skip loading parameter 'roi_heads.box_predictor.cls_score.bias' to the model due to incompatible shapes: (2,) in the checkpoint but (81,) in the model! You might want to double check if this is expected.
Skip loading parameter 'roi_heads.box_predictor.bbox_pred.weight' to the model due to incompatible shapes: (4, 1024) in the checkpoint but (320, 2048) in the model! You might want to double check if this is expected.
Skip loading parameter 'roi_heads.box_predictor.bbox_pred.bias' to the model due to incompatible shapes: (4,) in the checkpoint but (320,) in the model! You might want to double check if this is expected.
Some model parameters or buffers are not found in the checkpoint:
backbone.res2.0.conv1.norm.{bias, weight}
backbone.res2.0.conv1.weight
backbone.res2.0.conv2.norm.{bias, weight}
backbone.res2.0.conv2.weight
backbone.res2.0.conv3.norm.{bias, weight}
backbone.res2.0.conv3.weight
backbone.res2.0.shortcut.norm.{bias, weight}
backbone.res2.0.shortcut.weight
backbone.res2.1.conv1.norm.{bias, weight}
backbone.res2.1.conv1.weight
backbone.res2.1.conv2.norm.{bias, weight}
backbone.res2.1.conv2.weight
backbone.res2.1.conv3.norm.{bias, weight}
backbone.res2.1.conv3.weight
backbone.res2.2.conv1.norm.{bias, weight}
backbone.res2.2.conv1.weight
backbone.res2.2.conv2.norm.{bias, weight}
backbone.res2.2.conv2.weight
backbone.res2.2.conv3.norm.{bias, weight}
backbone.res2.2.conv3.weight
backbone.res3.0.conv1.norm.{bias, weight}
backbone.res3.0.conv1.weight
backbone.res3.0.conv2.norm.{bias, weight}
backbone.res3.0.conv2.weight
backbone.res3.0.conv3.norm.{bias, weight}
backbone.res3.0.conv3.weight
backbone.res3.0.shortcut.norm.{bias, weight}
backbone.res3.0.shortcut.weight
backbone.res3.1.conv1.norm.{bias, weight}
backbone.res3.1.conv1.weight
backbone.res3.1.conv2.norm.{bias, weight}
backbone.res3.1.conv2.weight
backbone.res3.1.conv3.norm.{bias, weight}
backbone.res3.1.conv3.weight
backbone.res3.2.conv1.norm.{bias, weight}
backbone.res3.2.conv1.weight
backbone.res3.2.conv2.norm.{bias, weight}
backbone.res3.2.conv2.weight
backbone.res3.2.conv3.norm.{bias, weight}
backbone.res3.2.conv3.weight
backbone.res3.3.conv1.norm.{bias, weight}
backbone.res3.3.conv1.weight
backbone.res3.3.conv2.norm.{bias, weight}
backbone.res3.3.conv2.weight
backbone.res3.3.conv3.norm.{bias, weight}
backbone.res3.3.conv3.weight
backbone.res4.0.conv1.norm.{bias, weight}
backbone.res4.0.conv1.weight
backbone.res4.0.conv2.norm.{bias, weight}
backbone.res4.0.conv2.weight
backbone.res4.0.conv3.norm.{bias, weight}
backbone.res4.0.conv3.weight
backbone.res4.0.shortcut.norm.{bias, weight}
backbone.res4.0.shortcut.weight
backbone.res4.1.conv1.norm.{bias, weight}
backbone.res4.1.conv1.weight
backbone.res4.1.conv2.norm.{bias, weight}
backbone.res4.1.conv2.weight
backbone.res4.1.conv3.norm.{bias, weight}
backbone.res4.1.conv3.weight
backbone.res4.2.conv1.norm.{bias, weight}
backbone.res4.2.conv1.weight
backbone.res4.2.conv2.norm.{bias, weight}
backbone.res4.2.conv2.weight
backbone.res4.2.conv3.norm.{bias, weight}
backbone.res4.2.conv3.weight
backbone.res4.3.conv1.norm.{bias, weight}
backbone.res4.3.conv1.weight
backbone.res4.3.conv2.norm.{bias, weight}
backbone.res4.3.conv2.weight
backbone.res4.3.conv3.norm.{bias, weight}
backbone.res4.3.conv3.weight
backbone.res4.4.conv1.norm.{bias, weight}
backbone.res4.4.conv1.weight
backbone.res4.4.conv2.norm.{bias, weight}
backbone.res4.4.conv2.weight
backbone.res4.4.conv3.norm.{bias, weight}
backbone.res4.4.conv3.weight
backbone.res4.5.conv1.norm.{bias, weight}
backbone.res4.5.conv1.weight
backbone.res4.5.conv2.norm.{bias, weight}
backbone.res4.5.conv2.weight
backbone.res4.5.conv3.norm.{bias, weight}
backbone.res4.5.conv3.weight
backbone.stem.conv1.norm.{bias, weight}
backbone.stem.conv1.weight
proposal_generator.rpn_head.anchor_deltas.{bias, weight}
proposal_generator.rpn_head.conv.{bias, weight}
proposal_generator.rpn_head.objectness_logits.{bias, weight}
roi_heads.box_predictor.bbox_pred.{bias, weight}
roi_heads.box_predictor.cls_score.{bias, weight}
roi_heads.res5.0.conv1.norm.{bias, weight}
roi_heads.res5.0.conv1.weight
roi_heads.res5.0.conv2.norm.{bias, weight}
roi_heads.res5.0.conv2.weight
roi_heads.res5.0.conv3.norm.{bias, weight}
roi_heads.res5.0.conv3.weight
roi_heads.res5.0.shortcut.norm.{bias, weight}
roi_heads.res5.0.shortcut.weight
roi_heads.res5.1.conv1.norm.{bias, weight}
roi_heads.res5.1.conv1.weight
roi_heads.res5.1.conv2.norm.{bias, weight}
roi_heads.res5.1.conv2.weight
roi_heads.res5.1.conv3.norm.{bias, weight}
roi_heads.res5.1.conv3.weight
roi_heads.res5.2.conv1.norm.{bias, weight}
roi_heads.res5.2.conv1.weight
roi_heads.res5.2.conv2.norm.{bias, weight}
roi_heads.res5.2.conv2.weight
roi_heads.res5.2.conv3.norm.{bias, weight}
roi_heads.res5.2.conv3.weight
The checkpoint state_dict contains keys that are not used by the model:
backbone.fpn_lateral2.{bias, weight}
backbone.fpn_output2.{bias, weight}
backbone.fpn_lateral3.{bias, weight}
backbone.fpn_output3.{bias, weight}
backbone.fpn_lateral4.{bias, weight}
backbone.fpn_output4.{bias, weight}
backbone.fpn_lateral5.{bias, weight}
backbone.fpn_output5.{bias, weight}
backbone.bottom_up.stem.conv1.weight
backbone.bottom_up.stem.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.0.shortcut.weight
backbone.bottom_up.res2.0.shortcut.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.0.conv1.weight
backbone.bottom_up.res2.0.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.0.conv2.weight
backbone.bottom_up.res2.0.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.0.conv3.weight
backbone.bottom_up.res2.0.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.1.conv1.weight
backbone.bottom_up.res2.1.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.1.conv2.weight
backbone.bottom_up.res2.1.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.1.conv3.weight
backbone.bottom_up.res2.1.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.2.conv1.weight
backbone.bottom_up.res2.2.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.2.conv2.weight
backbone.bottom_up.res2.2.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.2.conv3.weight
backbone.bottom_up.res2.2.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.0.shortcut.weight
backbone.bottom_up.res3.0.shortcut.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.0.conv1.weight
backbone.bottom_up.res3.0.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.0.conv2.weight
backbone.bottom_up.res3.0.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.0.conv3.weight
backbone.bottom_up.res3.0.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.1.conv1.weight
backbone.bottom_up.res3.1.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.1.conv2.weight
backbone.bottom_up.res3.1.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.1.conv3.weight
backbone.bottom_up.res3.1.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.2.conv1.weight
backbone.bottom_up.res3.2.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.2.conv2.weight
backbone.bottom_up.res3.2.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.2.conv3.weight
backbone.bottom_up.res3.2.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.3.conv1.weight
backbone.bottom_up.res3.3.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.3.conv2.weight
backbone.bottom_up.res3.3.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.3.conv3.weight
backbone.bottom_up.res3.3.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.0.shortcut.weight
backbone.bottom_up.res4.0.shortcut.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.0.conv1.weight
backbone.bottom_up.res4.0.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.0.conv2.weight
backbone.bottom_up.res4.0.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.0.conv3.weight
backbone.bottom_up.res4.0.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.1.conv1.weight
backbone.bottom_up.res4.1.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.1.conv2.weight
backbone.bottom_up.res4.1.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.1.conv3.weight
backbone.bottom_up.res4.1.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.2.conv1.weight
backbone.bottom_up.res4.2.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.2.conv2.weight
backbone.bottom_up.res4.2.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.2.conv3.weight
backbone.bottom_up.res4.2.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.3.conv1.weight
backbone.bottom_up.res4.3.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.3.conv2.weight
backbone.bottom_up.res4.3.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.3.conv3.weight
backbone.bottom_up.res4.3.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.4.conv1.weight
backbone.bottom_up.res4.4.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.4.conv2.weight
backbone.bottom_up.res4.4.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.4.conv3.weight
backbone.bottom_up.res4.4.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.5.conv1.weight
backbone.bottom_up.res4.5.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.5.conv2.weight
backbone.bottom_up.res4.5.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.5.conv3.weight
backbone.bottom_up.res4.5.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.6.conv1.weight
backbone.bottom_up.res4.6.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.6.conv2.weight
backbone.bottom_up.res4.6.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.6.conv3.weight
backbone.bottom_up.res4.6.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.7.conv1.weight
backbone.bottom_up.res4.7.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.7.conv2.weight
backbone.bottom_up.res4.7.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.7.conv3.weight
backbone.bottom_up.res4.7.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.8.conv1.weight
backbone.bottom_up.res4.8.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.8.conv2.weight
backbone.bottom_up.res4.8.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.8.conv3.weight
backbone.bottom_up.res4.8.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.9.conv1.weight
backbone.bottom_up.res4.9.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.9.conv2.weight
backbone.bottom_up.res4.9.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.9.conv3.weight
backbone.bottom_up.res4.9.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.10.conv1.weight
backbone.bottom_up.res4.10.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.10.conv2.weight
backbone.bottom_up.res4.10.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.10.conv3.weight
backbone.bottom_up.res4.10.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.11.conv1.weight
backbone.bottom_up.res4.11.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.11.conv2.weight
backbone.bottom_up.res4.11.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.11.conv3.weight
backbone.bottom_up.res4.11.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.12.conv1.weight
backbone.bottom_up.res4.12.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.12.conv2.weight
backbone.bottom_up.res4.12.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.12.conv3.weight
backbone.bottom_up.res4.12.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.13.conv1.weight
backbone.bottom_up.res4.13.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.13.conv2.weight
backbone.bottom_up.res4.13.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.13.conv3.weight
backbone.bottom_up.res4.13.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.14.conv1.weight
backbone.bottom_up.res4.14.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.14.conv2.weight
backbone.bottom_up.res4.14.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.14.conv3.weight
backbone.bottom_up.res4.14.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.15.conv1.weight
backbone.bottom_up.res4.15.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.15.conv2.weight
backbone.bottom_up.res4.15.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.15.conv3.weight
backbone.bottom_up.res4.15.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.16.conv1.weight
backbone.bottom_up.res4.16.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.16.conv2.weight
backbone.bottom_up.res4.16.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.16.conv3.weight
backbone.bottom_up.res4.16.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.17.conv1.weight
backbone.bottom_up.res4.17.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.17.conv2.weight
backbone.bottom_up.res4.17.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.17.conv3.weight
backbone.bottom_up.res4.17.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.18.conv1.weight
backbone.bottom_up.res4.18.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.18.conv2.weight
backbone.bottom_up.res4.18.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.18.conv3.weight
backbone.bottom_up.res4.18.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.19.conv1.weight
backbone.bottom_up.res4.19.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.19.conv2.weight
backbone.bottom_up.res4.19.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.19.conv3.weight
backbone.bottom_up.res4.19.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.20.conv1.weight
backbone.bottom_up.res4.20.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.20.conv2.weight
backbone.bottom_up.res4.20.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.20.conv3.weight
backbone.bottom_up.res4.20.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.21.conv1.weight
backbone.bottom_up.res4.21.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.21.conv2.weight
backbone.bottom_up.res4.21.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.21.conv3.weight
backbone.bottom_up.res4.21.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.22.conv1.weight
backbone.bottom_up.res4.22.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.22.conv2.weight
backbone.bottom_up.res4.22.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.22.conv3.weight
backbone.bottom_up.res4.22.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.0.shortcut.weight
backbone.bottom_up.res5.0.shortcut.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.0.conv1.weight
backbone.bottom_up.res5.0.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.0.conv2.weight
backbone.bottom_up.res5.0.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.0.conv3.weight
backbone.bottom_up.res5.0.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.1.conv1.weight
backbone.bottom_up.res5.1.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.1.conv2.weight
backbone.bottom_up.res5.1.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.1.conv3.weight
backbone.bottom_up.res5.1.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.2.conv1.weight
backbone.bottom_up.res5.2.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.2.conv2.weight
backbone.bottom_up.res5.2.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.2.conv3.weight
backbone.bottom_up.res5.2.conv3.norm.{bias, running_mean, running_var, weight}
roi_heads.box_head.fc1.{bias, weight}
roi_heads.box_head.fc2.{bias, weight}
roi_heads.mask_head.mask_fcn1.{bias, weight}
roi_heads.mask_head.mask_fcn2.{bias, weight}
roi_heads.mask_head.mask_fcn3.{bias, weight}
roi_heads.mask_head.mask_fcn4.{bias, weight}
roi_heads.mask_head.deconv.{bias, weight}
roi_heads.mask_head.predictor.{bias, weight}
/home/akshay/segmentation/detectron2/detectron2/modeling/roi_heads/fast_rcnn.py:154: UserWarning: This overload of nonzero is deprecated:
nonzero()
Consider using one of the following signatures instead:
nonzero(*, bool as_tuple) (Triggered internally at /pytorch/torch/csrc/utils/python_arg_parser.cpp:882.)
filter_inds = filter_mask.nonzero()
Is my model not trained properly? I am unsure if this is just a warning or there is an actual error. This is just for one custom class.
Upvotes: 4
Views: 3741
Reputation: 145
Inconsistencies between configuration settings during training and prediction can lead to such undesired outcomes. To ensure optimal model prediction consistency, it is imperative to maintain identical configurations throughout both stages. Following the completion of the training process, it is crucial to save the configuration file and subsequently load it when conducting predictions.
Upvotes: 0
Reputation: 283
I have found the solution.
I need to add the number of classes while defining the config file setings
cfg.MODEL.ROI_HEADS.NUM_CLASSES = num_of_classes
This fixed the problem
Upvotes: 3