Giter VIP home page Giter VIP logo

algorithmia's People

Contributors

snlpatel001213 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

algorithmia's Issues

Issue about keras.model.predict_classes

Hello, I'm currently working on making the algorithm working, still I have an issue at the end of the program about the predict_classes function in the last input.

I didn't change anything to the original code and imported all the modules specified in the requirement.
This is so the last input of the program.

folderName = "imdb_crop_resized128*128" 
fileNames =  glob.glob(folderName+"/*.jpg")
NumberOfFileToBetested = 500

x_batch,y_batch = turnToNumpy(fileNames[:NumberOfFileToBetested])

predictedAGE = model.predict_classes(x_batch)

realAGE = []
imagesCount = 0
os.mkdir('testImages')

for eachFilename in fileNames[:NumberOfFileToBetested]:
    realAGE = getRealAge(eachFilename)
    #saving Images
    x = load_image(eachFilename)
    x = x.reshape(x.shape[1],x.shape[2],x.shape[0])
    renamedImage = "testImages/"+str(realAGE)+"_"+str(predictedAGE[imagesCount])+".jpg"                                 
    imsave(renamedImage, x)
    imagesCount = imagesCount + 1

And there is the error specified. I don't know how to resolve this.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-17-7f653efe2f7b> in <module>()
      7 x_batch,y_batch = turnToNumpy(fileNames[:NumberOfFileToBetested])
      8 
----> 9 predictedAGE = model.predict_classes(x_batch)
     10 
     11 realAGE = []

~/Téléchargements/anaconda3/lib/python3.6/site-packages/keras/models.py in predict_classes(self, x, batch_size, verbose)
    824             A numpy array of class predictions.
    825         '''
--> 826         proba = self.predict(x, batch_size=batch_size, verbose=verbose)
    827         if proba.shape[-1] > 1:
    828             return proba.argmax(axis=-1)

~/Téléchargements/anaconda3/lib/python3.6/site-packages/keras/models.py in predict(self, x, batch_size, verbose)
    714         if self.model is None:
    715             self.build()
--> 716         return self.model.predict(x, batch_size=batch_size, verbose=verbose)
    717 
    718     def predict_on_batch(self, x):

~/Téléchargements/anaconda3/lib/python3.6/site-packages/keras/engine/training.py in predict(self, x, batch_size, verbose)
   1199         x = standardize_input_data(x, self.input_names,
   1200                                    self.internal_input_shapes,
-> 1201                                    check_batch_dim=False)
   1202         if self.stateful:
   1203             if x[0].shape[0] > batch_size and x[0].shape[0] % batch_size != 0:

~/Téléchargements/anaconda3/lib/python3.6/site-packages/keras/engine/training.py in standardize_input_data(data, names, shapes, check_batch_dim, exception_prefix)
     99                                  ' to have ' + str(len(shapes[i])) +
    100                                  ' dimensions, but got array with shape ' +
--> 101                                  str(array.shape))
    102             for j, (dim, ref_dim) in enumerate(zip(array.shape, shapes[i])):
    103                 if not j and not check_batch_dim:

ValueError: Error when checking : expected zeropadding2d_input_1 to have 4 dimensions, but got array with shape (0, 1)

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.