Giter VIP home page Giter VIP logo

decathlon / decavision Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 3.0 6.88 MB

Python package to help train image classification deep neural networks for generic datasets. Especially powerful when using with TPUs. The main advantages of the package is that is leverages the tfrecords format for the data along with transfer learning and hyperparameter optimization for model training.

Home Page: https://decavision-doc.herokuapp.com/

License: MIT License

Python 100.00%
deep-learning hyperparameter-optimization image-classification keras-tensorflow tfrecord transfer-learning

decavision's People

Contributors

hasibzunair avatar mitul23 avatar smercier88 avatar yangobeil avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

decavision's Issues

TF .pb wont save in Colab local

To save in Colab, we need to add some lines if we train with TPU because it usually requires to be saved to a Bucket. To overcome the use of a Bucket, add the SaveOptions as follows to the fit() function:

        if export_model:
            save_locally = tf.saved_model.SaveOptions(experimental_io_device='/job:localhost')
            self.model.save(export_model, options=save_locally)
            print('Model exported')

tensorflow version error

When using tensorflow higher than 2.9.1, B0, B5, B7 model can have this error when fitting

TypeError: Unable to serialize [2.0896919 2.1128857 2.1081853] to JSON. Unrecognized type <class 'tensorflow.python.framework.ops.EagerTensor'>.

So in the requirements.txt, we need to put tensorflow == 2.9.1

Image scaling issues

1- Currently, I believe the images are not scaled to a [0-1] range when we run the tfrecords generation followed by model training. This is OK for efficientnet models, because preprocessing is done by the model itself. That said, other models, like inception expect a scaled input.

2- I might we wrong, but I believe the scale variable, used for data augmentation and created here, should be the opposite. It should be 1 for models of the efficientnet family (because the model expect a tensor of [0-255] floats), while it should be 255 for the other models.

Make sure validation batch size smaller than validation dataset

By default the validation batch size is the same as the training batch size, but sometimes there are not many validation images and this gives an error when the batch size is larger than the number of validation images. I think we should add a check to make sure this does not happen.

Here is what I suggest. Add an extra value in the __init__ for the val_batch_size. If the batch size is smaller than the size of the validation dataset, then this value is the batch size. Otherwise we take something like half the size of the dataset. This will require to add the batch size as an argument in the _get_dataset method and use the correct one when we get a dataset.

Image overflow error

Screenshot 2023-01-30 at 10 59 13 AM

Found this bug when trying to unzip 26 000 images from gdrive. The solution I found was to unzip with a command line in the Colab terminal and it did the trick.

!unzip gdrive/MyDrive/image_dataset.zip > /dev/null

Maybe updating to PyDrive2 might solve the issue, but i am not shure !

ResNet support

Resnet is supported by decavision according to the docstring of the ImageClassifier class and has seen in the code here.

However, Resnet seems to be missing from the dict of input_dims

Can't save model to google storage on TPU

Colab now uses tensorflow 2.5 by default so using 2.4 causes problems when working with TPUs. For example saving a model to .pb format on google storage doesn't work even if it worked in the past. Switching to tensorflow 2.5 seems to fix the issue.

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.