ShengtianSang / AFMA

44 stars 9 forks source link

Small-Object Sensitive Segmentation Using Across Feature Map Attention

This is the source code for the method as described in our paper: Small-Object Sensitive Segmentation Using Across Feature Map Attention.

The overview of our method. (a) represents an overview of combining the AFMA method with a general semantic segmentation method. The encoder of the segmentation model is input to the AFMA method, and its output is applied to the output of the segmentation method. (b-i) presents a detailed illustration of combining the AFMA method with different semantic segmentation models.

The framework of our method. (a) Calculate the Across Feature Map Attention. The inputs are the initial image and i-th layer feature maps of the encoder. (b) Output Modification. The generated AFMA in (a) is used to modify the output of the decoder’s predicted masks. (c) The process of generating gold AFMA.

As shown in above framework figure. Our approache mainly consists of three parts:

Requirements

Data

In order to make it easier for the readers to reproduce and understand the code, I have provided a small amount of example data used in our experiment under the dataset folder, where provides six training, validation and test images for the CamVid.

File declaration

models/attonimage:contains the codes for calculating AFMA.

models/manet:the decoder and segmentation part of the manet_afma model.

models/unet: the decoder and segmentation part of the unet_afma model.

models/unetplusplus:the decoder and segmentation part of the unet++_afma model.

models/deeplabv3:the decoder and segmentation part of the deeplabv3_afma model.

models/fpn:the decoder and segmentation part of the fpn_afma model.

models/pan:the decoder and segmentation part of the pan_afma model.

models/linknet:the decoder and segmentation part of the linknet_afma model.

models/pspnet:the decoder and segmentation part of the pspnet_afma model.

main.py: The codes for training, validating and testing.

Run the codes

Install the environment.

pip install -r requirements.txt

Train and test the model.

python main.py