All Projects → creafz → Pytorch Cnn Finetune

creafz / Pytorch Cnn Finetune

Licence: mit
Fine-tune pretrained Convolutional Neural Networks with PyTorch

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Pytorch Cnn Finetune

Imagenet
Pytorch Imagenet Models Example + Transfer Learning (and fine-tuning)
Stars: ✭ 134 (-79.48%)
Mutual labels:  convolutional-neural-networks, pretrained-models
Ghostnet
CV backbones including GhostNet, TinyNet and TNT, developed by Huawei Noah's Ark Lab.
Stars: ✭ 1,744 (+167.08%)
Mutual labels:  convolutional-neural-networks, pretrained-models
Layer
Neural network inference the Unix way
Stars: ✭ 539 (-17.46%)
Mutual labels:  convolutional-neural-networks
Neuralkart
A Real-time Mario Kart AI using CNNs, Offline Search, and DAGGER
Stars: ✭ 644 (-1.38%)
Mutual labels:  convolutional-neural-networks
Dll
Fast Deep Learning Library (DLL) for C++ (ANNs, CNNs, RBMs, DBNs...)
Stars: ✭ 605 (-7.35%)
Mutual labels:  convolutional-neural-networks
Fchd Fully Convolutional Head Detector
Code for FCHD - A fast and accurate head detector
Stars: ✭ 555 (-15.01%)
Mutual labels:  convolutional-neural-networks
Gensim Data
Data repository for pretrained NLP models and NLP corpora.
Stars: ✭ 622 (-4.75%)
Mutual labels:  pretrained-models
Sketch simplification
Models and code related to sketch simplification of rough sketches.
Stars: ✭ 531 (-18.68%)
Mutual labels:  convolutional-neural-networks
Conv Emotion
This repo contains implementation of different architectures for emotion recognition in conversations.
Stars: ✭ 646 (-1.07%)
Mutual labels:  pretrained-models
Web Traffic Forecasting
Kaggle | Web Traffic Forecasting 📈
Stars: ✭ 596 (-8.73%)
Mutual labels:  convolutional-neural-networks
Pinto model zoo
A repository that shares tuning results of trained models generated by TensorFlow / Keras. Post-training quantization (Weight Quantization, Integer Quantization, Full Integer Quantization, Float16 Quantization), Quantization-aware training. TensorFlow Lite. OpenVINO. CoreML. TensorFlow.js. TF-TRT. MediaPipe. ONNX. [.tflite,.h5,.pb,saved_model,tfjs,tftrt,mlmodel,.xml/.bin, .onnx]
Stars: ✭ 634 (-2.91%)
Mutual labels:  pretrained-models
Fastmri
A large-scale dataset of both raw MRI measurements and clinical MRI images
Stars: ✭ 592 (-9.34%)
Mutual labels:  convolutional-neural-networks
Self Driving Car In Video Games
A deep neural network that learns to drive in video games
Stars: ✭ 559 (-14.4%)
Mutual labels:  pretrained-models
Emotion Recognition
Real time emotion recognition
Stars: ✭ 624 (-4.44%)
Mutual labels:  convolutional-neural-networks
Trending Deep Learning
Top 100 trending deep learning repositories sorted by the number of stars gained on a specific day.
Stars: ✭ 543 (-16.85%)
Mutual labels:  convolutional-neural-networks
Nlp Recipes
Natural Language Processing Best Practices & Examples
Stars: ✭ 5,783 (+785.6%)
Mutual labels:  pretrained-models
Stanford Cs 230 Deep Learning
VIP cheatsheets for Stanford's CS 230 Deep Learning
Stars: ✭ 5,149 (+688.51%)
Mutual labels:  convolutional-neural-networks
Functional Zoo
PyTorch and Tensorflow functional model definitions
Stars: ✭ 577 (-11.64%)
Mutual labels:  pretrained-models
Breast cancer classifier
Deep Neural Networks Improve Radiologists' Performance in Breast Cancer Screening
Stars: ✭ 614 (-5.97%)
Mutual labels:  pretrained-models
Saliency
TensorFlow implementation for SmoothGrad, Grad-CAM, Guided backprop, Integrated Gradients and other saliency techniques
Stars: ✭ 648 (-0.77%)
Mutual labels:  convolutional-neural-networks

Fine-tune pretrained Convolutional Neural Networks with PyTorch.

PyPI CircleCI codecov.io

Features

  • Gives access to the most popular CNN architectures pretrained on ImageNet.
  • Automatically replaces classifier on top of the network, which allows you to train a network with a dataset that has a different number of classes.
  • Allows you to use images with any resolution (and not only the resolution that was used for training the original model on ImageNet).
  • Allows adding a Dropout layer or a custom pooling layer.

Supported architectures and models

From the torchvision package:

  • ResNet (resnet18, resnet34, resnet50, resnet101, resnet152)
  • ResNeXt (resnext50_32x4d, resnext101_32x8d)
  • DenseNet (densenet121, densenet169, densenet201, densenet161)
  • Inception v3 (inception_v3)
  • VGG (vgg11, vgg11_bn, vgg13, vgg13_bn, vgg16, vgg16_bn, vgg19, vgg19_bn)
  • SqueezeNet (squeezenet1_0, squeezenet1_1)
  • MobileNet V2 (mobilenet_v2)
  • ShuffleNet v2 (shufflenet_v2_x0_5, shufflenet_v2_x1_0)
  • AlexNet (alexnet)
  • GoogLeNet (googlenet)

From the Pretrained models for PyTorch package:

  • ResNeXt (resnext101_32x4d, resnext101_64x4d)
  • NASNet-A Large (nasnetalarge)
  • NASNet-A Mobile (nasnetamobile)
  • Inception-ResNet v2 (inceptionresnetv2)
  • Dual Path Networks (dpn68, dpn68b, dpn92, dpn98, dpn131, dpn107)
  • Inception v4 (inception_v4)
  • Xception (xception)
  • Squeeze-and-Excitation Networks (senet154, se_resnet50, se_resnet101, se_resnet152, se_resnext50_32x4d, se_resnext101_32x4d)
  • PNASNet-5-Large (pnasnet5large)
  • PolyNet (polynet)

Requirements

  • Python 3.5+
  • PyTorch 1.1+

Installation

pip install cnn_finetune

Major changes:

Version 0.4

  • Default value for pretrained argument in make_model is changed from False to True. Now call make_model('resnet18', num_classes=10) is equal to make_model('resnet18', num_classes=10, pretrained=True)

Example usage:

Make a model with ImageNet weights for 10 classes

from cnn_finetune import make_model

model = make_model('resnet18', num_classes=10, pretrained=True)

Make a model with Dropout

model = make_model('nasnetalarge', num_classes=10, pretrained=True, dropout_p=0.5)

Make a model with Global Max Pooling instead of Global Average Pooling

import torch.nn as nn

model = make_model('inceptionresnetv2', num_classes=10, pretrained=True, pool=nn.AdaptiveMaxPool2d(1))

Make a VGG16 model that takes images of size 256x256 pixels

VGG and AlexNet models use fully-connected layers, so you have to additionally pass the input size of images when constructing a new model. This information is needed to determine the input size of fully-connected layers.

model = make_model('vgg16', num_classes=10, pretrained=True, input_size=(256, 256))

Make a VGG16 model that takes images of size 256x256 pixels and uses a custom classifier

import torch.nn as nn

def make_classifier(in_features, num_classes):
    return nn.Sequential(
        nn.Linear(in_features, 4096),
        nn.ReLU(inplace=True),
        nn.Linear(4096, num_classes),
    )

model = make_model('vgg16', num_classes=10, pretrained=True, input_size=(256, 256), classifier_factory=make_classifier)

Show preprocessing that was used to train the original model on ImageNet

>> model = make_model('resnext101_64x4d', num_classes=10, pretrained=True)
>> print(model.original_model_info)
ModelInfo(input_space='RGB', input_size=[3, 224, 224], input_range=[0, 1], mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
>> print(model.original_model_info.mean)
[0.485, 0.456, 0.406]

CIFAR10 Example

See examples/cifar10.py file (requires PyTorch 1.1+).

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].