Github Report Report

Our idea is to combine the SLIC algorithm with the Vision Transformer to improve the performance of the Vision Transformer.

Schematic diagram

pic

The full vision schematic diagram is in Miro.

Requirements

  • opencv
  • numpy
  • pytorch >=0.4.0
  • torchvision
  • skimage
  • matplotlib

One-line installation

pip install -r requirements.txt

Demo

We create a demo to show how SLIC algorithm works and how to use our work.

Usage

Run slic_main.py to get the result of SLIC algorithm.

In the main function, there are some parameters that can be changed.

slic(path, numSegments=100, ratio=0.9, size=16, save_choice=False)

path                   the path of the image (More details can be found in the section 'Dataset')
numSegments            the number of segments
ratio                  the ratio of the mask
size                   the size of the patches (if you want a 16*16*3 patch, size=16)
save_choice            whether to save the result (default is False)

If you choose to enable the save_choice, the result will be saved to the folder ‘patches’ with .jgp format. So, make sure you have an empty folder named ‘patches’ in the same directory.

In this repository, we generate some examples. You can find them in the folder patches.

Dataset

More details about dataset can be found in the README-dataset file.

Limitations

  • SLIC (skimage vision) does not support the GPU