In this rough record about the relevant process. If there are errors, please be an enthusiastic audience in front of the screen and put forward the correct solution
I setup script
Four words, twists and turns. As a layman of in-depth learning, the environmental configuration and installation in the early stage are quite tossed back and forth, but I'm very happy to run out in the end. Record several important points:
1. Version of each basic kit
nvidia driver : 470
cuda : 11.0
cudnn : 8.0.1 (just cuda)
pytorch 17.0
2. Precautions for installing detectron2
First of all, if the installation fails, be patient to find the problem in the error message. Don't just look at the last error message!!! After solving the error message, be sure to delete the build folder and reinstall it!
Because I only need to use the pre trained model to do panoramic segmentation for my test pictures, I can skip the train link. There is a command line for evaluation on github. Note that the checkpoint file path is downloaded from the model link in the readme table Path to pth file pth don't decompress it just because it's a compressed package (don't ask me why I'm so free, help me)
3. How to test your own data with panopticFCN?
Here, in fact, you can find it by looking at the issues. Thank the enthusiastic author and questioner for saving me a lot of things TAT, thank you!
First, open / path to detectron2 / demo / demo py. Move your embarrassed and divine eyes to line 27.
# To use demo for Panoptic-DeepLab, please uncomment the following two lines. # from detectron2.projects.panoptic_deeplab import add_panoptic_deeplab_config # noqa # add_panoptic_deeplab_config(cfg)
Did you see? What a kind programmer!
According to this, add two sentences here
from detectron2.projects.panopticfcn.config import add_panopticfcn_config # noqa add_panopticfcn_config(cfg)
Finally, record my test command line. At present, it is depressing that if he wants to test all the picture files in a folder by himself, he will report cuda out of memory after outputting several results.. I also changed the batch size in the config file to 1 (according to my shallow knowledge, this should have an impact during train, but will it have an impact during direct test?). The following *. png can output the results of the pictures in the folder, but sadly, there is no memory after a few outputs. What are these options and how to set them, you can see the get_parser() function in demo.py.
python3 demo/demo.py --config-file projects/PanopticFCN/configs/PanopticFCN-R50-3x-FAST.yaml --input /../listfolder/*.png --output /../output/
II About datasets
1. Dataset label
The coco dataset is used for panoramic segmentation. Naturally, you have to understand the meaning of those digital IDs in the tensor of the output results! Therefore, the following method is found to output a list at the terminal
For example, I'm actually looking at panoptic_ val2017. For the tag records in the JSON file, I directly created a python file coco in the folder where the file is located_ catagory. py
#!/usr/bin/python cat_2014 = './The path is actually changed casually/instances_val2014.json' cat_2017 = './panoptic_val2017.json' import sys, getopt import json def main(argv): json_file = None try: opts, args = getopt.getopt(argv,"hy:") except getopt.GetoptError: print('coco_categories.py -y <year>') sys.exit(2) for opt, arg in opts: if opt == '-y': if(arg == '2014'): json_file = cat_2014 else: json_file = cat_2017 if json_file is not None: with open(json_file,'r') as COCO: js = json.loads(COCO.read()) print(json.dumps(js['categories'])) if __name__ == "__main__": main(sys.argv[1:])
Then, run the following instructions in the terminal to see all the tags
python coco_catagory.py -y 2017