Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

deep-learning-models

> 编程语言
Open source

Keras code and weights files for popular deep learning models.

7.3K stars0 likes0 views
WebsiteGitHub

About

Keras code and weights files for popular deep learning models.

Trained image classification models for Keras

THIS REPOSITORY IS DEPRECATED. USE THE MODULE keras.applications INSTEAD.

Pull requests will not be reviewed nor merged. Direct any PRs to keras.applications. Issues are not monitored either.


This repository contains code for the following Keras models:

  • VGG16
  • VGG19
  • ResNet50
  • Inception v3
  • CRNN for music tagging

All architectures are compatible with both TensorFlow and Theano, and upon instantiation the models will be built according to the image dimension ordering set in your Keras configuration file at ~/.keras/keras.json. For instance, if you have set image_dim_ordering=tf, then any model loaded from this repository will get built according to the TensorFlow dimension ordering convention, "Width-Height-Depth".

Pre-trained weights can be automatically loaded upon instantiation (weights='imagenet' argument in model constructor for all image models, weights='msd' for the music tagging model). Weights are automatically downloaded if necessary, and cached locally in ~/.keras/models/.

Examples

Classify images

python
from resnet50 import ResNet50
from keras.preprocessing import image
from imagenet_utils import preprocess_input, decode_predictions

model = ResNet50(weights='imagenet')

img_path = 'elephant.jpg'
img = image.load_img(img_path, target_size=(224, 224))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)

preds = model.predict(x)
print('Predicted:', decode_predictions(preds))
# print: [[u'n02504458', u'African_elephant']]

Extract features from images

python
from vgg16 import VGG16
from keras.preprocessing import image
from imagenet_utils import preprocess_input

model = VGG16(weights='imagenet', include_top=False)

img_path = 'elephant.jpg'
img = image.load_img(img_path, target_size=(224, 224))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)

features = model.predict(x)

Extract features from an arbitrary intermediate layer

python
from vgg19 import VGG19
from keras.preprocessing import image
from imagenet_utils import preprocess_input
from keras.models import Model

base_model = VGG19(weights='imagenet')
model = Model(input=base_model.input, output=base_model.get_layer('block4_pool').output)

img_path = 'elephant.jpg'
img = image.load_img(img_path, target_size=(224, 224))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)

block4_pool_features = model.predict(x)

References

  • Very Deep Convolutional Networks for Large-Scale Image Recognition - please cite this paper if you use the VGG models in your work.
  • Deep Residual Learning for Image Recognition - please cite this paper if you use the ResNet model in your work.
  • Rethinking the Inception Architecture for Computer Vision - please cite this paper if you use the Inception v3 model in your work.
  • Music-auto_tagging-keras

Additionally, don't forget to cite Keras if you use these models.

License

  • All code in this repository is under the MIT license as specified by the LICENSE file.
  • The ResNet50 weights are ported from the ones released by Kaiming He under the MIT license.
  • The VGG16 and VGG19 weights are ported from the ones released by VGG at Oxford under the Creative Commons Attribution License.
  • The Inception v3 weights are trained by ourselves and are released under the MIT license.

Issues· 88 open

View all issuesOpen on GitHub
  • #127

    cannot download vgg16_weights #33

    Updated Aug 17, 2025
  • #33

    cannot download vgg16_weights

    Updated Mar 21, 2024
  • #125

    I downloaded the pretrained model of resnet50 but it doesn't works

    Updated Feb 20, 2024
  • #96

    Validation accuracy stays 0.5 when Retraining ResNet50, others are fine

    Updated Dec 23, 2023
  • #101

    can't download inceptionV3 weights in keras

    Updated Apr 5, 2023
  • #119

    download speed too slow

    Updated Aug 19, 2022
  • #69

    issues with VGG16 weights

    Updated Aug 1, 2022
  • #104

    ResNet50 unexpected keyword argument 'include_top'

    Updated Aug 16, 2021
  • #17

    Create a ResNet50 model fails

    Updated Jun 8, 2021
  • #90

    Are this models for Tensorflow backend ot=r Theano backend?

    Updated Mar 29, 2021

> Tags

Python

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 2, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言