facebookresearch / detectron2

Detectron2 is a platform for object detection, segmentation and other visual recognition tasks.
https://detectron2.readthedocs.io/en/latest/
Apache License 2.0
30.17k stars 7.43k forks source link

Classification yaml missing. #3110

Closed petoor closed 3 years ago

petoor commented 3 years ago

After the push of https://github.com/facebookresearch/detectron2/commit/76963c909120d8ca046a18f5f399d5dc1b8a480f torchvision_imagenet_R_50.py has been added to detectron2/configs/Misc/

However, this is not a yaml file but a py file.

A classification yaml file is still missing.

petoor commented 3 years ago

Let me add to this. It would be very nice with a config file that you can load with for instance DefaultTrainer(cfg) and get a classification model.

ppwwyyxx commented 3 years ago

https://github.com/facebookresearch/detectron2/blob/master/tools/lazyconfig_train_net.py can train with this config file. This is working as expected.

petoor commented 3 years ago

Hi @ppwwyyxx

Strictly speaking. That file is a python file containing model definitions.

A config file is a Meta file containing only specifications.

Putting that file under for instance detectron2/detectron2/modeling/ and then have a yaml file that generates a model would make more sense

ppwwyyxx commented 3 years ago

Putting model definitions in the config file is allowed. I agree this does not always make sense. It is up to users whether they would like to use it this way.

For this particular case, this file is made only to demonstrate how one can do classification if they need to. Detectron2 does not aim to become a classification library therefore we don't plan to add classification models into detectron2/modeling.

petoor commented 3 years ago

1) If you would like to integrate detectron2 into a database, the yaml file fits in a jsonfield. However having actual python code would not fit in such a field.

2) Since the code for classification is already working, it would make sense to integrate it into d2. That way you can have the full monty of image analysis - Classification, Semantic, Instance, Detection, Panoptic.... It would make sense to support all 5 and not just the 4 of them (especially since classification can be done as simple as a dense layer after the backbone)

3) This is a user request : https://github.com/facebookresearch/detectron2/issues/892

Again, it seems silly not to have classification in d2 since it is a low hanging fruit and your python code is already working.

petoor commented 3 years ago

@ppwwyyxx if i create a PR for this. Would it be merged?

ppwwyyxx commented 3 years ago

It wouldn't in the near future. It's easy to get something "working", as you said. But that's different from deciding to support classification. However, you are very welcome create your own project that uses the detectron2 engine to do classification, and there have been a few projects that do this: https://github.com/tkianai/ImageClassification.detectron2 https://github.com/Megvii-BaseDetection/cvpods