In this project we use both Resnet and Self-attention layer for cat, dog and flower classification.

Overview

cdf_att_classification

classes = {0: 'cat', 1: 'dog', 2: 'flower'}

In this project we use both Resnet and Self-attention layer for cdf-Classification. Specifically, For Resnet, we extract low level features from Convolutional Neural Network (CNN) trained on Dogcatflower_2 dataset(details show later).
We take inspiration from the Self-attention mechanism which is a prominent method in cv domain. We also use Grad-CAM algorithm to Visualize the gradient of the back propagation of the pretrain model to understand this network. The code is released for academic research use only. For commercial use, please contact [[email protected]].

Installation

Clone this repo.

git clone https://github.com/Alan-lab/cdf_classification
cd cdf_classification/

This code requires pytorch, python3.7, cv2, d2l. Please install it.

Dataset Preparation

For cdf_classification, the datasets must be downloaded beforehand. Please download them on the respective webpages. Please cite them if you use the data.

Preparing Cat and Dog Dataset. The dataset can be downloaded here.

Preparing flower Dataset. The dataset can be downloaded here.

You can also download Dogcatflower_2 dataset(made from above datasets) use the following link:

Link:https://pan.baidu.com/s/1ZcP_isbbRQBq9BHU6p_VtQ

key:oz7z

Training New Models

  1. Prepare your own dataset like this (https://github.com/Alan-lab/data/Dogcatflower_2).

  2. Training:

python main.py

model.pth will be extrated in the folder ./cdf_classification.

If av_test_acc < 0.75, model.pth will not save(d2l.train_ch6).

3.Predict

Prepare your valid dataset like this (https://github.com/Alan-lab/data/catsdogsflowers/valid1).

python Predict/predict.py

4.Class Activation Map The response size of the feature map is mapped to the original image, allowing readers to understand the effect of the model more intuitively. Prepare your picture like this (https://github.com/Alan-lab/data/Dogcatflower/test/flower/flower.1501.jpg).

python Viewer/Grad_CAM.py
  1. More details can be found in folder.

The Experimental Result

  1. Preformance
dataset Cat-acc Dog-acc flower-acc
Dogcatflower_2_train 96.2 88.7 93.6
Dogcatflower_2_test 72.7 69.2 89.7
catsdogsflowers_valid1 75.1 76.9 91.4
catsdogsflowers_valid2 75.5 73.5 92.9

2.Visualization

Postive sample fig1 fig2 fig3

Negative sample fig4

Multi-attention

show_attention

Acknowledgments

This work is mainly supported by (https://courses.d2l.ai/zh-v2/) and CSDN.

Contributions

If you have any questions/comments/bug reports, feel free to open a github issue or pull a request or e-mail to the author Lailanqing ([email protected]).

State-of-the-art language models can match human performance on many tasks

Status: Archive (code is provided as-is, no updates expected) Grade School Math [Blog Post] [Paper] State-of-the-art language models can match human p

OpenAI 259 Jan 08, 2023
Neighbor2Seq: Deep Learning on Massive Graphs by Transforming Neighbors to Sequences

Neighbor2Seq: Deep Learning on Massive Graphs by Transforming Neighbors to Sequences This repository is an official PyTorch implementation of Neighbor

DIVE Lab, Texas A&M University 8 Jun 12, 2022
A large-scale benchmark for co-optimizing the design and control of soft robots, as seen in NeurIPS 2021.

Evolution Gym A large-scale benchmark for co-optimizing the design and control of soft robots. As seen in Evolution Gym: A Large-Scale Benchmark for E

121 Dec 14, 2022
Our CIKM21 Paper "Incorporating Query Reformulating Behavior into Web Search Evaluation"

Reformulation-Aware-Metrics Introduction This codebase contains source-code of the Python-based implementation of our CIKM 2021 paper. Chen, Jia, et a

xuanyuan14 5 Mar 05, 2022
Woosung Choi 63 Nov 14, 2022
Torchreid: Deep learning person re-identification in PyTorch.

Torchreid Torchreid is a library for deep-learning person re-identification, written in PyTorch. It features: multi-GPU training support both image- a

Kaiyang 3.7k Jan 05, 2023
True Few-Shot Learning with Language Models

This codebase supports using language models (LMs) for true few-shot learning: learning to perform a task using a limited number of examples from a single task distribution.

Ethan Perez 124 Jan 04, 2023
Backend code to use MCPI's python API to make infinite worlds with custom generation

inf-mcpi Backend code to use MCPI's python API to make infinite worlds with custom generation Does not save player-placed blocks! Generation is still

5 Oct 04, 2022
Final term project for Bayesian Machine Learning Lecture (XAI-623)

Mixquality_AL Final Term Project For Bayesian Machine Learning Lecture (XAI-623) Youtube Link The presentation is given in YoutubeLink Problem Formula

JeongEun Park 3 Jan 18, 2022
Disease Informed Neural Networks (DINNs) — neural networks capable of learning how diseases spread, forecasting their progression, and finding their unique parameters (e.g. death rate).

DINN We introduce Disease Informed Neural Networks (DINNs) — neural networks capable of learning how diseases spread, forecasting their progression, a

19 Dec 10, 2022
Visualizer for neural network, deep learning, and machine learning models

Netron is a viewer for neural network, deep learning and machine learning models. Netron supports ONNX (.onnx, .pb, .pbtxt), Keras (.h5, .keras), Tens

Lutz Roeder 21k Jan 06, 2023
DvD-TD3: Diversity via Determinants for TD3 version

DvD-TD3: Diversity via Determinants for TD3 version The implementation of paper Effective Diversity in Population Based Reinforcement Learning. Instal

3 Feb 11, 2022
A benchmark framework for Tensorflow

TensorFlow benchmarks This repository contains various TensorFlow benchmarks. Currently, it consists of two projects: PerfZero: A benchmark framework

1.1k Dec 30, 2022
《Unsupervised 3D Human Pose Representation with Viewpoint and Pose Disentanglement》(ECCV 2020) GitHub: [fig9]

Unsupervised 3D Human Pose Representation [Paper] The implementation of our paper Unsupervised 3D Human Pose Representation with Viewpoint and Pose Di

42 Nov 24, 2022
Meta Language-Specific Layers in Multilingual Language Models

Meta Language-Specific Layers in Multilingual Language Models This repo contains the source codes for our paper On Negative Interference in Multilingu

Zirui Wang 20 Feb 13, 2022
RL-driven agent playing tic-tac-toe on starknet against challengers.

tictactoe-on-starknet RL-driven agent playing tic-tac-toe on starknet against challengers. GUI reference: https://pythonguides.com/create-a-game-using

21 Jul 30, 2022
Dealing With Misspecification In Fixed-Confidence Linear Top-m Identification

Dealing With Misspecification In Fixed-Confidence Linear Top-m Identification This repository is the official implementation of [Dealing With Misspeci

0 Oct 25, 2021
An implementation of Deep Forest 2021.2.1.

Deep Forest (DF) 21 DF21 is an implementation of Deep Forest 2021.2.1. It is designed to have the following advantages: Powerful: Better accuracy than

LAMDA Group, Nanjing University 795 Jan 03, 2023
Generative Autoregressive, Normalized Flows, VAEs, Score-based models (GANVAS)

GANVAS-models This is an implementation of various generative models. It contains implementations of the following: Autoregressive Models: PixelCNN, G

MRSAIL (Mini Robotics, Software & AI Lab) 6 Nov 26, 2022
Neural Articulated Radiance Field

Neural Articulated Radiance Field NARF Neural Articulated Radiance Field Atsuhiro Noguchi, Xiao Sun, Stephen Lin, Tatsuya Harada ICCV 2021 [Paper] [Co

Atsuhiro Noguchi 144 Jan 03, 2023