Giter Club home page Giter Club logo

senet-keras's Introduction

SENet (Keras implementation)


New information

  • We provide a trained SEResNeXt model (training data: cifar10)
    Google drive
    You can try this model in evaluate-cifar10.ipynb.

Naive implementation of SENet models in Keras.

Prerequisites

  • nvidia-docker environment

Environment constuction

  • Build a docker image (on the root directory of the repository)
    $ docker build -t [tag name] -f docker/Dockerfile .
    
  • Create a container using the image
    $ nvidia-docker run -it -v $PWD:/work [tag name]
    

Train a model

  • Train a model with cifar10 data.
    (in the container) $ pwd
    /work
    (in the container) $ python train-cifar10.py
    

Note that this script is written in an insufficient way; use data generator in consideration of expansion to general image data). The training speed is slow. On a p3.2xlarge instance, it takes about 1.5 days.

Evaluate the model

  • Launch a jupyter notebook.
    (in the container) $ bash launch_notebook.sh
    
  • Execute evaluate-cifar10.ipynb notebook.

Results

  • Accuracy plot of train/val.
     result

  • Loss plot of train/val.
     result

  • Accuracy for the test data.
    92.38%

senet-keras's People

Contributors

yoheikikuta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

senet-keras's Issues

model load error

I train senet model like this:

senet =SEResNeXt.SEResNeXt(224,12).model
adam = tensorflow.keras.optimizers.Adam(lr=0.001, beta_1=0.9, beta_2=0.999, decay=1e-6)
senet.compile(loss='categorical_crossentropy',optimizer=adam, metrics=['accuracy'])
filepath="model_val/weights-improvement-{epoch:02d}-{acc:.2f}.hdf5"
checkpoint = ModelCheckpoint(filepath, monitor='acc', verbose=1, save_best_only=True, mode='max')
senet.fit(X, Y ,epochs=200, batch_size=2,callbacks=[checkpoint ])

When I try to load trained model, i got this :

model = load_model('model_val/weights-improvement-32-0.95.hdf5') File "/home/tensorflow04/anaconda3/lib/python3.6/site-packages/keras/models.py", line 240, in load_model model = model_from_config(model_config, custom_objects=custom_objects) File "/home/tensorflow04/anaconda3/lib/python3.6/site-packages/keras/models.py", line 314, in model_from_config return layer_module.deserialize(config, custom_objects=custom_objects) File "/home/tensorflow04/anaconda3/lib/python3.6/site-packages/keras/layers/__init__.py", line 55, in deserialize printable_module_name='layer') File "/home/tensorflow04/anaconda3/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 139, in deserialize_keras_object list(custom_objects.items()))) File "/home/tensorflow04/anaconda3/lib/python3.6/site-packages/keras/engine/topology.py", line 2490, in from_config process_layer(layer_data) File "/home/tensorflow04/anaconda3/lib/python3.6/site-packages/keras/engine/topology.py", line 2476, in process_layer custom_objects=custom_objects) File "/home/tensorflow04/anaconda3/lib/python3.6/site-packages/keras/layers/__init__.py", line 55, in deserialize printable_module_name='layer') File "/home/tensorflow04/anaconda3/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 139, in deserialize_keras_object list(custom_objects.items()))) File "/home/tensorflow04/anaconda3/lib/python3.6/site-packages/keras/layers/core.py", line 696, in from_config printable_module_name='function in Lambda layer') File "/home/tensorflow04/anaconda3/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 156, in deserialize_keras_object fn = module_objects.get(function_name) AttributeError: 'NoneType' object has no attribute 'get'

The role of the "channel"

This project is very useful to me, thank you very much. But can you tell me what is the role of the "channel" in line 136 of the SEResNeXt.py file? The object "channel" appears only once in the entire file.

help

在吗 ?代码运行出错 ValueError: An operation has None for gradient. Please make sure that all of your ops have a gradient defined (i.e. are differentiable). Common ops without gradient: K.argmax, K.round, K.eval.

batch_size=?

Excuse me, my computer can only run when batch_size=1, what is your batch_size set to?

Cannot make it parallel

I create my model like this:
model = SEResNeXt(size=256, num_classes=4).model
When I try to run the model on several GPUs by
parallel_model = multi_gpu_model(model, gpus=nb_gpu)
I got this error:
Concatenate layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, None, None, 32), (None, 128, 128, 64), (None, None, None, 32)]

python = 3.4.3
keras = 2.0.9

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.