GithubHelp home page GithubHelp logo

cifar-vgg's People

Contributors

geifmany 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

cifar-vgg's Issues

Low accuracy for cifar100

When evaluating this model with cifar100 weights, I get accrucay of 0.17.
However, when training again I get 0.68%

Stuck at first Epoch

I cloned the repository and its stuck at displaying "Epoch 1/250" and no training is happening. Also I doubt where is the cifar10 dataset getting downloaded? cifar10.load_data() right? Is it that because its downloading the dataset, that's why its stuck at Epoch 1/250? Once it gets downloaded the training will start?

P.S. I don't have GPU.

load_weights returns empty list

Hello,

Your code works very well, but why do I get empty list when I fo get_weights of the model after loading the weights? I have done two small modification in your code in order to save the model and the weights.

Change 1: A save function in the class cifar10vgg

def save(self):
   model_json = self.model.to_json()
   self.model.save_weights('./model/model_cifar10vgg_weights.h5')
   self.model.save('./model/model_cifar10vgg.h5')
    with open('./model/model_cifar10vgg.json', 'w') as json_file:
        json_file.write(model_json)

Change 2: model.save() in the main loop

When I try to implement

import tensorflow.keras.backend as K
from tensorflow.keras.models import model_from_json
from tensorflow.keras.models import load_model

K.clear_session()

with open('./model/model_cifar10vgg.json', 'r') as f:
    model = model_from_json(f.read())
    
model = load_model('./model/model_cifar10vgg.h5')
model.load_weights("./model/model_cifar10vgg_weights.h5")
model.summary()

print("model.layers[-2].get_weights()", model.layers[-1].get_weights())

The output is:

model.layers[-2].get_weights() []

Image sizes

How do the image sizes change through the net? Is 32 px input width enough?

License

Would it be possible to change the license to something permissive, e.g. MIT? The current choice (Gpl 3) disallows using your code in permissively licensed repositories.

Loss is NaN and the acc = ~0.10

Hi Geifmany,

I tried your vanilla code here to understand how Keras works.
But when I run it, the model experience loss : nan and acc: ~0.10

Did you also experience it?
If not, is there any parameter that you tune?

问题

Using TensorFlow backend.
(10, 4)
WARNING:tensorflow:From /Users/mengfan/PycharmProjects/untitled1/venv/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
Traceback (most recent call last):
File "/Users/mengfan/PycharmProjects/untitled1/VGG2.py", line 370, in
main()
File "/Users/mengfan/PycharmProjects/untitled1/VGG2.py", line 312, in main
model = VGG()
File "/Users/mengfan/PycharmProjects/untitled1/VGG2.py", line 120, in init
self.model = self.train(self.model)
File "/Users/mengfan/PycharmProjects/untitled1/VGG2.py", line 291, in train
validation_data=(X_test, y_test),callbacks=[reduce_lr],verbose=2)
File "/Users/mengfan/PycharmProjects/untitled1/venv/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/Users/mengfan/PycharmProjects/untitled1/venv/lib/python3.6/site-packages/keras/engine/training.py", line 1418, in fit_generator
initial_epoch=initial_epoch)
File "/Users/mengfan/PycharmProjects/untitled1/venv/lib/python3.6/site-packages/keras/engine/training_generator.py", line 40, in fit_generator
model._make_train_function()
File "/Users/mengfan/PycharmProjects/untitled1/venv/lib/python3.6/site-packages/keras/engine/training.py", line 496, in _make_train_function
raise RuntimeError('You must compile your model before using it.')
RuntimeError: You must compile your model before using it.

Process finished with exit code 1

出现这个问题如何解决

I did't get the same accuracy?

I read the paper " Very Deep Convolutional Neural Network Based Image Classification Using
Small Training Sample Size" carefully and found the following difference between the code and the original paper?

  • We add Batch Normalization layer before every nonlinearity. (that's mean before "Relu activation function ") but here it after it ?

  • The momentum, base learning rate and base weight decay rate are set to be 0.9, 0.001, 0.006 (but here the learning rate starts from 0.1 ? )

  • "mini-batch SGD" is used by the original paper, but here it's SGD .

could you please explain it me ?

How were weights computed?

Hello, I just wanted to ask a question to clarify about your computed weights. Did you initialize them with the weights from the original VGG-16 network, or did you start from random initializations when you trained?

Hi,I ran this code on cpu and continuously got nan

Here's what I got. I wonder if I did anything wrong or should I change any paras?
Epoch 8/250

  • 2994s - loss: nan - acc: 0.0999 - val_loss: nan - val_acc: 0.1000
    Epoch 9/250
  • 2870s - loss: nan - acc: 0.0995 - val_loss: nan - val_acc: 0.1000
    Epoch 10/250
  • 3146s - loss: nan - acc: 0.1007 - val_loss: nan - val_acc: 0.1000
    Epoch 11/250
  • 2894s - loss: nan - acc: 0.0996 - val_loss: nan - val_acc: 0.1000

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.