[PYTHON] Try to implement yolact

mini_2boxes.png

environment

setup

git clone https://github.com/dbolya/yolact.git
cd yolact
pip install opencv-python pillow==6.2.1 pycocotools matplotlib
pip install cython
pip install torch==1.2.0 torchvision==0.4.0    # CUDA10.Stable at 0

Compile DCNv2 when using yolact ++

cd external/DCNv2
python setup.py develop

Inference with trained model

  1. Download the trained model https://drive.google.com/file/d/15id0Qq5eqRbkD-N3ZjDZXdCvRyIaHpFB/view?usp=sharing
  2. Perform inference

Learn with original data

  1. Prepare the dataset in coco format (image + JSON)
  2. Download the pre-learning model
  1. Modify the config file (2 places) First fill in the database definition,

        test_dataset = dataset_base.copy({
            'name': 'Test Dataset',
    
            'train_images': 'path_to_training_images',
            'train_info':   'path_to_training_annotation',
    
            'valid_images': 'path_to_validation_images',
            'valid_info':   'path_to_validation_annotation',
    
            'has_gt': True,
            'class_names': ('my_class_id_1', 'my_class_id_2', 'my_class_id_3', ...)
        })
    

Then change the default config file and exit.

```py:data/config.py
    yolact_base_config = coco_base_config.copy({
        'name': 'yolact_base',

        # Dataset stuff
        # 'dataset': coco2017_dataset,    # default
        'dataset': test_dataset,    # Original Dataset

        # 'num_classes': len(coco2017_dataset.class_names) + 1,
        'num_classes': len(test_dataset.class_names) + 1,
    })
```
  1. Learning
  1. Model accuracy evaluation

Recommended Posts

Try to implement yolact
Try to implement Oni Maitsuji Miserable in python
Try to factorial with recursion
Try to analyze Twitter trends
Try to understand Python self
I tried to implement PCANet
Try to select a language
I tried to implement StarGAN (1)
Try to implement linear regression using Pytorch with Google Colaboratory
I tried to implement Deep VQE
Try to draw a Bezier curve
Try to operate Facebook with Python
Try to profile with ONNX Runtime
Try using pynag to configure Nagios
Try to introduce the theme to Pelican
I tried to implement adversarial validation
Try to calculate Trace in Python
Try to put data in MongoDB
Try converting cloudmonkey CLI to python3 -1
Try to get statistics using e-Stat
I tried to implement hierarchical clustering
Cython to try in the shortest
I tried to implement Realness GAN
Try to implement and understand the segment tree step by step (python)
Try to output audio with M5STACK
The fastest way to try EfficientNet
The easiest way to try PyQtGraph
I tried to implement PLSA in Python
Try to reproduce color film with Python
Try logging in to qiita with Python
Stack problem: Try to solve "20. Valid Parentheses"
I tried to implement Autoencoder with TensorFlow
I tried to implement permutation in Python
Try to face the integration by parts
Try to make a kernel of Jupyter
I tried to implement PLSA in Python 2
Try Return to libc due to buffer overflow
Try to reproduce NumPy's add.at in Julia
Sample to comprehensively try OpenCV Optical Flow
How to implement nested serializer in drf-flex-fields
Try to detect fusion movement using AnyMotion
Try to predict cherry blossoms with xgboost
I tried to implement ADALINE in Python
Try to operate Excel using Python (Xlwings)
Try to prepare each environment of kivy
Try converting to tidy data with pandas
Quickly try to visualize datasets with pandas
[Linux convenient command] Try to insert vivid
I tried to implement PPO in Python
Python amateurs try to summarize the list ①
I tried to implement CVAE with PyTorch
First YDK to try with Cisco IOS-XE
Try to classify O'Reilly books by clustering
How to implement Scroll View in pythonista 1
Try to generate an image with aliasing
Try to make something like C # LINQ
Try to download Youtube videos using Pytube
Try to implement a binary dict-like internal emulation of Python's standard map type