trainableactivation

Implementation for the article "Trainable Activations for Image Classification"

https://github.com/epishchik/trainableactivation

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.6%) to scientific vocabulary

Keywords

activation-functions cifar-10 convolutional-neural-networks deep-neural-networks mnist pytorch resnet
Last synced: 6 months ago · JSON representation ·

Repository

Implementation for the article "Trainable Activations for Image Classification"

Basic Info
Statistics
  • Stars: 24
  • Watchers: 1
  • Forks: 2
  • Open Issues: 0
  • Releases: 0
Topics
activation-functions cifar-10 convolutional-neural-networks deep-neural-networks mnist pytorch resnet
Created over 3 years ago · Last pushed over 2 years ago
Metadata Files
Readme License Citation

README.md

[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/trainable-activations-for-image/image-classification-on-mnist)](https://paperswithcode.com/sota/image-classification-on-mnist?p=trainable-activations-for-image) [![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/trainable-activations-for-image/image-classification-on-cifar-10)](https://paperswithcode.com/sota/image-classification-on-cifar-10?p=trainable-activations-for-image)

Trainable Activations for Image Classification

We propose a set of the trainable activation functions — Cosinu-Sigmoidal Linear Unit (CosLU), DELU, Linear Combination (LinComb), Normalized Linear Combination (NormLinComb), Rectified Linear Unit N (ReLUN), Scaled Soft Sign (ScaledSoftSign), Shifted Rectified Linear Unit (ShiLU).

Pretrained weights.

CosLU

$$CosLU(x) = (x + \alpha \cos(\beta x))\sigma(x)$$

$$\sigma(x) = \frac{1}{1 + e^{-x}}$$

CosLU

DELU

$$ DELU(x) = \begin{cases} SiLU(x), x \leqslant 0 \ (n + 0.5)x + |e^{-x} - 1|, x > 0 \end{cases} $$

$$SiLU(x) = x\sigma(x)$$

DELU

LinComb

$$LinComb(x) = \sum\limits{i=0}^{n} wi \mathcal{F}_i(x)$$

LinComb

NormLinComb

$$NormLinComb(x) = \frac{\sum\limits{i=0}^{n} wi \mathcal{F}_i(x)}{\mid \mid W \mid \mid}$$

NormLinComb

ReLUN

$$ReLUN(x) = min(max(0, x), n)$$

ReLUN

ScaledSoftSign

$$ScaledSoftSign(x) = \frac{\alpha x}{\beta + |x|}$$

ScaledSoftSign

ShiLU

$$ShiLU(x) = \alpha ReLU(x) + \beta$$

$$ReLU(x) = max(0, x)$$

ShiLU

INSTALLATION

Create venv. bash python3 -m venv venv

Activate venv. bash source venv/bin/activate

Install dependencies. bash pip install -r requirements.txt

PROJECT STRUCTURE

There are 3 main files - train.py, test.py, plot.py. You should run train.py first, then test.py, then plot.py.

Use whatever configuration you want to test. Configurations can be found in the configs folder, train.py and test.py use the same config. There are several plot configurations in the configs/plot folder.

There are many predefined run scripts in the scripts folder, just run one of them as .sh, scripts/train.sh and scripts/test.sh are scripts to train and test all possible configurations, scripts/plot.sh to plot results after training and testing.

All the results of the train / test phases are in the logs folder.

All proposed trainable activations are in activation.py.

HOW TO RUN

Let's say I want to train and test the ResNet-8 model with CosLU trainable activation on the CIFAR-10 dataset. python python train.py --config configs/coslu/cifar10/resnet8.yaml python test.py --config configs/coslu/cifar10/resnet8.yaml

If you want to train and test all proposed trainable activations with a specific model and dataset, you can use the script from the scripts folder. For example, train and test the DNN2 model on the MNIST dataset. bash sh scripts/dnn2_mnist.sh

Train and test all possible configurations. bash sh scripts/train.sh sh scripts/test.sh

Plot graphics for all configurations, it will work even if some configurations haven't been trained. bash sh scripts/plot.sh

CITATION

Project CITATION.

LICENSE

Project is distributed under MIT License.

Owner

  • Name: Evgenii Pishchik
  • Login: epishchik
  • Kind: user
  • Location: Moscow, Russia

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
title: "Trainable Activations for Image Classification"
authors:
- family-names: "Pishchik"
  given-names: "Evgenii"
  orcid: "https://orcid.org/0000-0001-6614-4419"
date-released: 2023-01-26
url: "https://github.com/Pe4enIks/TrainableActivation"
preferred-citation:
  type: article
  title: "Trainable Activations for Image Classification"
  authors:
  - family-names: "Pishchik"
    given-names: "Evgenii"
    orcid: "https://orcid.org/0000-0001-6614-4419"
  doi: "10.20944/preprints202301.0463.v1"
  month: 1
  year: 2023

GitHub Events

Total
  • Watch event: 4
Last Year
  • Watch event: 4