Home

Awesome

Small Object Few-shot Segmentation for Vision-based Industrial Inspection

This is an official PyTorch implementation of the paper Small Object Few-shot Segmentation for Vision-based Industrial Inspection.

@article{zhang2024small,
  title={Small Object Few-shot Segmentation for Vision-based Industrial Inspection},
  author={Zhang, Zilong and Niu, Chang and Zhao, Zhibin and Zhang, Xingwu and Chen, Xuefeng},
  journal={arXiv preprint arXiv:2407.21351},
  year={2024}
}
<p align="center"> <img src=assets/paradigm.png width="100%"> </p> <p align="center"> <img src=assets/SOFS.jpg width="100%"> </p>

We present SOFS to solve problems that various and sufficient defects are difficult to obtain and anomaly detection cannot detect specific defects in Vision-based Industrial Inspection. SOFS can quickly adapt to unseen classes without retraining, achieving few-shot semantic segmentation (FSS) and few-shot anomaly detection (FAD). SOFS can segment the small defects conditioned on the support sets, e.g., it segments the defects with area proportions less than 0.03%. Some visualizations are shown in the figure below.

<p align="center"> <img src=assets/vis.jpg width="100%"> </p>

Visualizations under Open Domain

<p align="center"> <img src=assets/steel.png width="70%"> </p>

Installation

  1. The default python version is python 3.8.
  2. Follow the installation of DINO v2, such as xFormers.
  3. Use the following commands:
pip install -r requirements.txt

Train and test on VISION V1 dataset or Ds spectrum

bash train.sh

Inference

Prepare for Your Own Data

|-- Your Own Data (object name)
    |-- support
        |-- image
        |-- mask
    |-- query
        |-- image

Test on your own dataset

sh test.sh

To-Do List

Acknowledgement

We acknowledge the excellent implementation from DINO v2, HDMNet.

License

The code is released under the CC BY-NC-SA 4.0 license.