All Projects → ElefHead → numpy-cnn

ElefHead / numpy-cnn

Licence: other
A numpy based CNN implementation for classifying images

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to numpy-cnn

pcdarts-tf2
PC-DARTS (PC-DARTS: Partial Channel Connections for Memory-Efficient Differentiable Architecture Search, published in ICLR 2020) implemented in Tensorflow 2.0+. This is an unofficial implementation.
Stars: ✭ 25 (-46.81%)
Mutual labels:  cifar10, cifar-10
DenseNet-Cifar10
Train DenseNet on Cifar-10 based on Keras
Stars: ✭ 39 (-17.02%)
Mutual labels:  cifar10, cifar-10
pytorch-cifar-model-zoo
Implementation of Conv-based and Vit-based networks designed for CIFAR.
Stars: ✭ 62 (+31.91%)
Mutual labels:  cifar10, cnn-classification
cifar10
Predict CIFAR-10 labels with 88% accuracy using keras.
Stars: ✭ 32 (-31.91%)
Mutual labels:  cifar10, cifar-10
gans-2.0
Generative Adversarial Networks in TensorFlow 2.0
Stars: ✭ 76 (+61.7%)
Mutual labels:  cifar10, cifar-10
srVAE
VAE with RealNVP prior and Super-Resolution VAE in PyTorch. Code release for https://arxiv.org/abs/2006.05218.
Stars: ✭ 56 (+19.15%)
Mutual labels:  cifar10, cifar-10
Dawn Bench Entries
DAWNBench: An End-to-End Deep Learning Benchmark and Competition
Stars: ✭ 254 (+440.43%)
Mutual labels:  cifar10
ResidualAttentionNetwork
A Gluon implement of Residual Attention Network. Best acc on cifar10-97.78%.
Stars: ✭ 104 (+121.28%)
Mutual labels:  cifar10
Pytorch cifar10
Pretrained TorchVision models on CIFAR10 dataset (with weights)
Stars: ✭ 219 (+365.96%)
Mutual labels:  cifar10
Nnpulearning
Non-negative Positive-Unlabeled (nnPU) and unbiased Positive-Unlabeled (uPU) learning reproductive code on MNIST and CIFAR10
Stars: ✭ 181 (+285.11%)
Mutual labels:  cifar10
DCGAN-CIFAR10
A implementation of DCGAN (Deep Convolutional Generative Adversarial Networks) for CIFAR10 image
Stars: ✭ 18 (-61.7%)
Mutual labels:  cifar10
ocsvm-anomaly-detection
anomaly detection by one-class SVM
Stars: ✭ 66 (+40.43%)
Mutual labels:  cifar10
shake-drop pytorch
PyTorch implementation of shake-drop regularization
Stars: ✭ 50 (+6.38%)
Mutual labels:  cifar10
Weapon-Detection-And-Classification
Weapon Detection & Classification through CCTV surveillance using Deep Learning-CNNs.
Stars: ✭ 53 (+12.77%)
Mutual labels:  cnn-classification
temporal-ensembling-semi-supervised
Keras implementation of temporal ensembling(semi-supervised learning)
Stars: ✭ 22 (-53.19%)
Mutual labels:  cifar10
Tf Vqvae
Tensorflow Implementation of the paper [Neural Discrete Representation Learning](https://arxiv.org/abs/1711.00937) (VQ-VAE).
Stars: ✭ 226 (+380.85%)
Mutual labels:  cifar10
Image-Classification-by-Keras-and-Tensorflow
Image Classification using Keras as well as Tensorflow.
Stars: ✭ 79 (+68.09%)
Mutual labels:  cnn-classification
Simclr
A PyTorch implementation of SimCLR based on ICML 2020 paper "A Simple Framework for Contrastive Learning of Visual Representations"
Stars: ✭ 198 (+321.28%)
Mutual labels:  cifar10
pyTorch-text-classification
pyTorch-text-classification
Stars: ✭ 15 (-68.09%)
Mutual labels:  cnn-classification
Semantic Segmentation
Semantic Segmentation using Fully Convolutional Neural Network.
Stars: ✭ 60 (+27.66%)
Mutual labels:  fully-connected-network

Numpy CNN

A numpy based CNN implementation for classifying images.

status: archived

Usage

Follow the steps listed below for using this repository after cloning it.
For examples, you can look at the code in fully_connected_network.py and cnn.py.
I placed the data inside a folder called data within the project root folder (this code works by default with cifar10, for other datasets, the filereader in utilities can't be used).

After placing data, the directory structure looks as follows

  • root
    • data\
      • data_batch_1
      • data_batch_2
      • ..
    • layers\
    • loss\
    • utilities\
    • cnn.py
    • fully_connected_network.py

  1. Import the required layer classes from layers folder, for example
    from layers.fully_connected import FullyConnected
    from layers.convolution import Convolution
    from layers.flatten import Flatten
  2. Import the activations and losses in a similar way, for example
    from layers.activation import Elu, Softmax
    from loss.losses import CategoricalCrossEntropy
  3. Import the model class from utilities folder
    from utilities.model import Model
  4. Create a model using Model and layer classes
    model = Model(
        Convolution(filters=5, padding='same'),
        Elu(),
        Pooling(mode='max', kernel_shape=(2, 2), stride=2),
        Flatten(),
        FullyConnected(units=10),
        Softmax(),
        name='cnn-model'
    )
  5. Set model loss
    model.set_loss(CategoricalCrossEntropy)
  6. Train the model using
    model.train(data, labels)
    • set load_and_continue = True for loading trained weights and continue training
    • By default the model uses AdamOptimization with AMSgrad
    • It also saves the weights after each epoch to a models folder within the project
  7. For prediction, use
    prediction = model.predict(data)
  8. For calculating accuracy, the model class provides its own function
    accuracy = model.evaluate(data, labels)
  9. To load model in a different place with the trained weights, follow till step 5 and then
    model.load_weights()
    Note: You will have to have similar directory structure.

This was a fun project that started out as me trying to implement a CNN by myself for classifying cifar10 images. In process, I was able to implement a reusable (numpy based) library-ish code for creating CNNs with adam optimization.

Anyone wanting to understand how backpropagation works in CNNs is welcome to try out this code, but for all practical usage there are better frameworks with performances that this code cannot even come close to replicating.

The CNN implemented here is based on Andrej Karpathy's notes

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].