All Projects → qubvel → Classification_models

qubvel / Classification_models

Licence: mit
Classification models trained on ImageNet. Keras.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Classification models

Keras Idiomatic Programmer
Books, Presentations, Workshops, Notebook Labs, and Model Zoo for Software Engineers and Data Scientists wanting to learn the TF.Keras Machine Learning framework
Stars: ✭ 720 (-23.24%)
Mutual labels:  resnet, mobilenet, densenet, vgg, resnext
Cnn Models
ImageNet pre-trained models with batch normalization for the Caffe framework
Stars: ✭ 355 (-62.15%)
Mutual labels:  resnet, imagenet, pretrained-models, vgg
Imagenet
Pytorch Imagenet Models Example + Transfer Learning (and fine-tuning)
Stars: ✭ 134 (-85.71%)
Mutual labels:  resnet, pretrained-models, densenet, vgg
Mmclassification
OpenMMLab Image Classification Toolbox and Benchmark
Stars: ✭ 532 (-43.28%)
Mutual labels:  resnet, imagenet, mobilenet, resnext
Pytorch Classification
Classification with PyTorch.
Stars: ✭ 1,268 (+35.18%)
Mutual labels:  resnet, imagenet, densenet, resnext
Tensornets
High level network definitions with pre-trained weights in TensorFlow
Stars: ✭ 982 (+4.69%)
Mutual labels:  resnet, mobilenet, densenet, vgg
Pytorch Cifar100
Practice on cifar100(ResNet, DenseNet, VGG, GoogleNet, InceptionV3, InceptionV4, Inception-ResNetv2, Xception, Resnet In Resnet, ResNext,ShuffleNet, ShuffleNetv2, MobileNet, MobileNetv2, SqueezeNet, NasNet, Residual Attention Network, SENet, WideResNet)
Stars: ✭ 2,423 (+158.32%)
Mutual labels:  resnet, mobilenet, densenet, resnext
Imagenet
This implements training of popular model architectures, such as AlexNet, ResNet and VGG on the ImageNet dataset(Now we supported alexnet, vgg, resnet, squeezenet, densenet)
Stars: ✭ 126 (-86.57%)
Mutual labels:  resnet, imagenet, densenet, vgg
Segmentation models
Segmentation models with pretrained backbones. Keras and TensorFlow Keras.
Stars: ✭ 3,575 (+281.13%)
Mutual labels:  resnet, mobilenet, densenet, resnext
Octconv.pytorch
PyTorch implementation of Octave Convolution with pre-trained Oct-ResNet and Oct-MobileNet models
Stars: ✭ 229 (-75.59%)
Mutual labels:  resnet, imagenet, mobilenet
sparsezoo
Neural network model repository for highly sparse and sparse-quantized models with matching sparsification recipes
Stars: ✭ 264 (-71.86%)
Mutual labels:  resnet, pretrained-models, mobilenet
Basic cnns tensorflow2
A tensorflow2 implementation of some basic CNNs(MobileNetV1/V2/V3, EfficientNet, ResNeXt, InceptionV4, InceptionResNetV1/V2, SENet, SqueezeNet, DenseNet, ShuffleNetV2, ResNet).
Stars: ✭ 374 (-60.13%)
Mutual labels:  resnet, densenet, resnext
Tensorrtx
Implementation of popular deep learning networks with TensorRT network definition API
Stars: ✭ 3,456 (+268.44%)
Mutual labels:  resnet, vgg, resnext
Pytorch classification
利用pytorch实现图像分类的一个完整的代码,训练,预测,TTA,模型融合,模型部署,cnn提取特征,svm或者随机森林等进行分类,模型蒸馏,一个完整的代码
Stars: ✭ 395 (-57.89%)
Mutual labels:  resnet, densenet, resnext
Chainer Cifar10
Various CNN models for CIFAR10 with Chainer
Stars: ✭ 134 (-85.71%)
Mutual labels:  resnet, densenet, vgg
python cv AI ML
用python做计算机视觉,人工智能,机器学习,深度学习等
Stars: ✭ 73 (-92.22%)
Mutual labels:  vgg, densenet, resnet
ModelZoo.pytorch
Hands on Imagenet training. Unofficial ModelZoo project on Pytorch. MobileNetV3 Top1 75.64🌟 GhostNet1.3x 75.78🌟
Stars: ✭ 42 (-95.52%)
Mutual labels:  imagenet, resnet, mobilenet
Cifar Zoo
PyTorch implementation of CNNs for CIFAR benchmark
Stars: ✭ 584 (-37.74%)
Mutual labels:  resnet, densenet, resnext
pytorch2keras
PyTorch to Keras model convertor
Stars: ✭ 788 (-15.99%)
Mutual labels:  imagenet, densenet, resnet
regnet.pytorch
PyTorch-style and human-readable RegNet with a spectrum of pre-trained models
Stars: ✭ 50 (-94.67%)
Mutual labels:  imagenet, pretrained-models, resnext

PyPI version Build Status

Classification models Zoo - Keras (and TensorFlow Keras)

Trained on ImageNet classification models. The library is designed to work both with Keras and TensorFlow Keras. See example below.

Important!

There was a huge library update 05 of August. Now classification-models works with both frameworks: keras and tensorflow.keras. If you have models, trained before that date, to load them, please, use image-classifiers (PyPI package name) of 0.2.2 version. You can roll back using pip install -U image-classifiers==0.2.2.

Architectures:

Specification

The top-k accuracy were obtained using center single crop on the 2012 ILSVRC ImageNet validation set and may differ from the original ones. The input size used was 224x224 (min size 256) for all models except:

  • NASNetLarge 331x331 (352)
  • InceptionV3 299x299 (324)
  • InceptionResNetV2 299x299 (324)
  • Xception 299x299 (324)

The inference *Time was evaluated on 500 batches of size 16. All models have been tested using same hardware and software. Time is listed just for comparison of performance.

Model [email protected] [email protected] Time* Source
vgg16 70.79 89.74 24.95 keras
vgg19 70.89 89.69 24.95 keras
resnet18 68.24 88.49 16.07 mxnet
resnet34 72.17 90.74 17.37 mxnet
resnet50 74.81 92.38 22.62 mxnet
resnet101 76.58 93.10 33.03 mxnet
resnet152 76.66 93.08 42.37 mxnet
resnet50v2 69.73 89.31 19.56 keras
resnet101v2 71.93 90.41 28.80 keras
resnet152v2 72.29 90.61 41.09 keras
resnext50 77.36 93.48 37.57 keras
resnext101 78.48 94.00 60.07 keras
densenet121 74.67 92.04 27.66 keras
densenet169 75.85 92.93 33.71 keras
densenet201 77.13 93.43 42.40 keras
inceptionv3 77.55 93.48 38.94 keras
xception 78.87 94.20 42.18 keras
inceptionresnetv2 80.03 94.89 54.77 keras
seresnet18 69.41 88.84 20.19 pytorch
seresnet34 72.60 90.91 22.20 pytorch
seresnet50 76.44 93.02 23.64 pytorch
seresnet101 77.92 94.00 32.55 pytorch
seresnet152 78.34 94.08 47.88 pytorch
seresnext50 78.74 94.30 38.29 pytorch
seresnext101 79.88 94.87 62.80 pytorch
senet154 81.06 95.24 137.36 pytorch
nasnetlarge 82.12 95.72 116.53 keras
nasnetmobile 74.04 91.54 27.73 keras
mobilenet 70.36 89.39 15.50 keras
mobilenetv2 71.63 90.35 18.31 keras

Weights

Name Classes Models
'imagenet' 1000 all models
'imagenet11k-place365ch' 11586 resnet50
'imagenet11k' 11221 resnet152

Installation

Requirements:

  • Keras >= 2.2.0 / TensorFlow >= 1.12
  • keras_applications >= 1.0.7
Note
This library does not have TensorFlow in a requirements for installation. 
Please, choose suitable version (‘cpu’/’gpu’) and install it manually using 
official Guide (https://www.tensorflow.org/install/).

PyPI stable package:

$ pip install image-classifiers==0.2.2

PyPI latest package:

$ pip install image-classifiers==1.0.0b1

Latest version:

$ pip install git+https://github.com/qubvel/classification_models.git

Examples

Loading model with imagenet weights:
# for keras
from classification_models.keras import Classifiers

# for tensorflow.keras
# from classification_models.tfkeras import Classifiers

ResNet18, preprocess_input = Classifiers.get('resnet18')
model = ResNet18((224, 224, 3), weights='imagenet')

This way take one additional line of code, however if you would like to train several models you do not need to import them directly, just access everything through Classifiers.

You can get all model names using Classifiers.models_names() method.

Inference example:
import numpy as np
from skimage.io import imread
from skimage.transform import resize
from keras.applications.imagenet_utils import decode_predictions
from classification_models.keras import Classifiers

ResNet18, preprocess_input = Classifiers.get('resnet18')

# read and prepare image
x = imread('./imgs/tests/seagull.jpg')
x = resize(x, (224, 224)) * 255    # cast back to 0-255 range
x = preprocess_input(x)
x = np.expand_dims(x, 0)

# load model
model = ResNet18(input_shape=(224,224,3), weights='imagenet', classes=1000)

# processing image
y = model.predict(x)

# result
print(decode_predictions(y))
Model fine-tuning example:
import keras
from classification_models.keras import Classifiers

ResNet18, preprocess_input = Classifiers.get('resnet18')

# prepare your data
X = ...
y = ...

X = preprocess_input(X)

n_classes = 10

# build model
base_model = ResNet18(input_shape=(224,224,3), weights='imagenet', include_top=False)
x = keras.layers.GlobalAveragePooling2D()(base_model.output)
output = keras.layers.Dense(n_classes, activation='softmax')(x)
model = keras.models.Model(inputs=[base_model.input], outputs=[output])

# train
model.compile(optimizer='SGD', loss='categorical_crossentropy', metrics=['accuracy'])
model.fit(X, y)
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].