Closed agp-ka32 closed 4 years ago
Please include details about the problem following the issue template. It looks like you're setting datasets to "coco" instead of your own dataset.
Sure. Here are the details according to the [issue template]:(https://github.com/facebookresearch/detectron2/issues/new?template=unexpected-problems-bugs.md)
1) I did not change any line of code. 2) I just created a folder named "coco" inside the "./datasets" directory and added the annotations and image files as required by detectron2. To be specific, the "annotations" subfolder contains instance_train2014 and instance_val2014 json files. And the "train2014" and "val2014" subfolders contain the respective image file names included in the json files. 3) The full log is as below:
I do not know how to set the datasets to something else other than "coco". Is it because of not changing the dataset name? If yes, how do I make this modification?
Please let me know if the above details are sufficient enough for my error to be understood. If not, let me know what other details are needed.
Thanks.
@ppwwyyxx Could you help with this issue? Thanks.
I just created a folder named "coco" inside the "./datasets" directory and added the annotations and image files as required by detectron2. To be specific, the "annotations" subfolder contains instance_train2014 and instance_val2014 json files. And the "train2014" and "val2014" subfolders contain the respective image file names included in the json files.
You are not allowed to do this. COCO is COCO. Please do not call other datasets "COCO" or put other datasets under the directory "COCO".
Please call register_coco_instances
(https://detectron2.readthedocs.io/modules/data.html#detectron2.data.datasets.register_coco_instances) for other datasets that are in coco format. See more at https://detectron2.readthedocs.io/tutorials/datasets.html
Thank you!
HI @ppwwyyxx Could you please tell me in which file to add the extra line of register_cooc_instances ? Thank you very much!!!
You can add it in any place (e.g., in your own train_net.py) as long as it will be executed before you create the data loader.
Hi @ppwwyyxx Thank you so much ! I add the line in train_net.py , but it makes another error !!
:~/pythoncode/detectron2$ python tools/train_net.py --config-file configs/COCO-Detection/faster_rcnn_R_101_FPN_3x.yaml SOLVER.IMS_PER_BATCH 2 SOLVER.BASE_LR 0.0025
Traceback (most recent call last):
File "tools/train_net.py", line 155, in
I really don't know how to modify it , Could you please take a look at it for me? Thank you so much !
You can not call your dataset "coco_2014_train" since it's used for coco.
Yes , it is works ! thank you a lot ! @ppwwyyxx
I did exactly the same as mentioned here but still getting the following issue: AssertionError: Attribute 'thing_classes' in the metadata of 'coco_2017_train' cannot be set to a different value!
I have not changed anything in the code, just followed the same procedure mentioned here: create dataset - coco/annotations and coco/image-folders, registered the dataset by calling register_coco_instances into tools/train_net.py and used the same training command as used by @zsc1220.
One thing that I have noted is when I merely print the Json_file supplied to register_coco.py like this:
I see the output as:
Looks like it registers all the COCO datasets even when I just want my custom dataset to be registered.
Can somebody please point me to a solution to this?
Thanks,
I have the same problem. I have registered my own dataset:
register_coco_instances("class_x", {}, "/home/user/a/datasets/coco/annotations/instances_train2017.json",
"/home/user/car/datasets/coco/train2017/")
and still Im getting:
AssertionError: Attribute 'thing_classes' in the metadata of 'coco_2017_train' cannot be set to a different value!
['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light', 'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee', 'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard', 'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch', 'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone', 'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear', 'hair drier', 'toothbrush'] != ['class_x']
Did somebody managed to solve it ? @sameer00123 @ppwwyyxx @zsc1220 @akshaygadipatil
Please do not call other datasets 'COCO' if they are not COCO.
If you need help to solve an unexpected issue you observed, please include details following the "Unexpected behaviors" issue template.
I alse met this problem,above methods did not work for me ,can you help me ?
@ppwwyyxx
If you need help to solve an unexpected issue you observed, please include details following the "Unexpected behaviors" issue template.
I also encountered this issue. I found that the main reason is Metadata
doesn't allow reassigning existing attrs to different values.
https://github.com/facebookresearch/detectron2/blob/master/detectron2/data/catalog.py#L146-L153
This can be resolved using monkey patch to overwrite this method.
@zhanghang1989 , could you please show us a line of code to do this monkey patch?
Thanks,
@zhanghang1989 , could you please show us a line of code to do this monkey patch?
Thanks,
You may create a new function as a monkey patch and then call that function. something like:
def hardsetpatch(self, key, val):
super().__setattr__(key, val)
Metadata.hardset = hardsetpatch
Metadata.hardset(key, val)
@akshaygadipatil I met the same problem,how could you sovle it?
@12306,could you solve the problem?
@zhanghang1989 , could you please show us a line of code to do this monkey patch? Thanks,
You may create a new function as a monkey patch and then call that function. something like:
def hardsetpatch(self, key, val): super().__setattr__(key, val) Metadata.hardset = hardsetpatch Metadata.hardset(key, val)
where to put these lines? in the catalog.py? please show us specifically, thanks a lot. did you solve the problem? @zhanghang1989 and how? I met the same problem.
@d12306
@zhanghang1989 , could you please show us a line of code to do this monkey patch? Thanks,
You may create a new function as a monkey patch and then call that function. something like:
def hardsetpatch(self, key, val): super().__setattr__(key, val) Metadata.hardset = hardsetpatch Metadata.hardset(key, val)
where to put these lines? in the catalog.py? please show us specifically, thanks a lot. did you solve the problem? @zhanghang1989 and how? I met the same problem.
Put it where you would like to reset some attributes.
❓ Questions and Help
Hi, I am trying to train on my dataset with just 4 classes. When I run it, I get an error as below: The scripts are interlinked a lot and therefore a bit difficult to debug. How to resolve this?
Thanks.