项目作者: PathofData

项目描述 :
Tensorflow-keras implementations of ResNeXt and dual path network architectures
高级语言: Python
项目地址: git://github.com/PathofData/Tensorflow-models.git
创建时间: 2020-02-02T13:58:39Z
项目社区:https://github.com/PathofData/Tensorflow-models

开源协议:MIT License

下载


Tensorflow models

In this repository you can find Tensorflow-keras implementations of ResNeXt and dual path network model architectures.

Instructions

In order to be able to use these models tensorflow version at least 2.1 needs to be installed on your environment.
Follow the instructions at https://www.tensorflow.org/install to see available options for installation.

In order to load the models onto your code follow the steps listed below.

Open a terminal and paste the following code to make a local copy of this repository:

  1. # Clone the repository onto a local folder
  2. git clone https://github.com/PathofData/Tensorflow-models.git

Then inside your python code import the model of your choice:

  1. # Import the DPN module
  2. from DPN50 import DPN50
  3. # Initiallize a new model instance where the image dimension
  4. # is (224, 224, 3) and we wish to predict 1000 classes
  5. vision_model = DPN50(include_top=True,
  6. weights=None,
  7. input_tensor=None,
  8. input_shape=(224, 224, 3),
  9. pooling=None,
  10. classes=1000)

Optionally print a summary of the model:

  1. # Print each layere input, output shapes and number of parameters
  2. vision_model.summary()

Once you have prepared a dataset for training use this model like how one would use any instance of keras models

  1. # Compile the model with an optimizer and a loss function
  2. vision_model.compile(optimizer='adam', loss='sparse_categorical_crossentropy')
  3. # Train the model on some data
  4. vision_model.fit(X_train, y_train)