MIT License

项目介绍

kobiso/CBAM-tensorflow 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 MIT License 许可证,目前获得 151 个 Star、63 次 Fork。

仓库全名
kobiso/CBAM-tensorflow
开源许可证
MIT License
Star 数
151
Fork 数
63
未关闭 Issue
7

README 摘要

CBAM-TensorFlow This is a Tensorflow implementation of "CBAM: Convolutional Block Attention Module". This repository includes the implementation of "Squeeze-and-Excitation Networks" as well, so that you can train and compare among base CNN model, base model with CBAM block and base model with SE block. Base CNN models are ResNext, Inception-V4, and Inception-ResNet-V2 where the implementation is revised from Junho…

完整内容见 GitHub 原始 README 或本页 。

常见问题

CBAM-tensorflow 用什么语言开发?

主要使用 Python 编写,采用 MIT License 许可证,目前有 151 个 Star。

CBAM-tensorflow 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 CBAM-tensorflow 的源码?

可以直接克隆仓库:git clone https://github.com/kobiso/CBAM-tensorflow.git,默认分支为 master;安装与运行步骤见仓库 README。

CBAM-tensorflow 最近还在维护吗?

仓库最近一次更新为 2018年8月31日,当前有 7 个未关闭 Issue;Star 数为 151,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

CBAM implementation on TensowFlow

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
279
价值分
109
活跃状态
活跃

语言占比

Python
Shell

贡献者

README

CBAM-TensorFlow

This is a Tensorflow implementation of “CBAM: Convolutional Block Attention Module”. This repository includes the implementation of “Squeeze-and-Excitation Networks” as well, so that you can train and compare among base CNN model, base model with CBAM block and base model with SE block. Base CNN models are ResNext, Inception-V4, and Inception-ResNet-V2 where the implementation is revised from Junho Kim’s code: SENet-Tensorflow.

If you want to use more sophisticated implementation and more base models to use, check the repository “CBAM-TensorFlow-Slim” which aims to be compatible on the TensorFlow-Slim image classification model library and support more base models.

CBAM: Convolutional Block Attention Module

CBAM proposes an architectural unit called “Convolutional Block Attention Module” (CBAM) block to improve representation power by using attention mechanism: focusing on important features and supressing unnecessary ones. This research can be considered as a descendant and an improvement of “Squeeze-and-Excitation Networks”.

Diagram of a CBAM_block

Diagram of each attention sub-module

Classification results on ImageNet-1K

Prerequisites

  • Python 3.x
  • TensorFlow 1.x
  • tflearn

Prepare Data set

This repository use Cifar10 dataset. When you run the training script, the dataset will be automatically downloaded.

CBAM_block and SE_block Supportive Models

You can train and test base CNN model, base model with CBAM block and base model with SE block. You can run CBAM_block or SE_block added models in the below list by adding one argument --attention_module=cbam_block or --attention_module=se_block when you train a model.

  • Inception V4 + CBAM / + SE
  • Inception-ResNet-v2 + CBAM / + SE
  • ResNeXt + CBAM / + SE

Change Reduction ratio

To change reduction ratio, you can add an argument --reduction_ratio=8.

Train a Model

You can simply run a model by executing following scripts.

  • sh train_ResNext.sh
  • sh train_inception_resnet_v2.sh
  • sh train_inception_v4.sh

Train a model with CBAM_block

Below script gives you an example of training a model with CBAM_block.

CUDA_VISIBLE_DEVICES=0 python ResNeXt.py \
--model_name put_your_model_name \
--attention_module cbam_block  \
--reduction_ratio 8 \
--learning_rate 0.1 \
--weight_decay 0.0005 \
--momentum 0.9 \
--batch_size 128 \
--total_epoch 100 \
--attention_module cbam_block

Train a model with SE_block

Below script gives you an example of training a model with SE_block.

CUDA_VISIBLE_DEVICES=0 python ResNeXt.py \
--model_name put_your_model_name \
--attention_module cbam_block  \
--reduction_ratio 8 \
--learning_rate 0.1 \
--weight_decay 0.0005 \
--momentum 0.9 \
--batch_size 128 \
--total_epoch 100 \
--attention_module se_block

Train a model without attention module

Below script gives you an example of training a model without attention module.

CUDA_VISIBLE_DEVICES=0 python ResNeXt.py \
--model_name put_your_model_name \
--attention_module cbam_block  \
--reduction_ratio 8 \
--learning_rate 0.1 \
--weight_decay 0.0005 \
--momentum 0.9 \
--batch_size 128 \
--total_epoch 100

Reference

Author

Byung Soo Ko / [email protected]

评论

暂无评论