Git Product home page Git Product logo

Comments (4)

seeyourcell avatar seeyourcell commented on May 8, 2024 1

if use tensorflow,change model.predict to "
def predict(self, image):
if image.shape != (1, 3, IMAGE_SIZE, IMAGE_SIZE):
image = resize_with_pad(image)
if K.image_dim_ordering() == 'th':
image = image.reshape((1, 3, IMAGE_SIZE, IMAGE_SIZE))
else:
image = image.reshape((1, IMAGE_SIZE, IMAGE_SIZE ,3))
image = image.astype('float32')
image /= 255
result = self.model.predict_proba(image)
print(result)
result = self.model.predict_classes(image)

    return result[0]

"

then the "Exception: Error when checking : expected convolution2d_input_1 to have shape (None, 64, 64, 3) but got array with shape (1, 3, 64, 64)" disappear.

from bosssensor.

Hironsan avatar Hironsan commented on May 8, 2024

what is your image_dim_ordering? th or tf?

https://keras.io/backend/

from bosssensor.

tornadoyi avatar tornadoyi commented on May 8, 2024

/Users/Jason/ML/BossSensor/camera_reader.py
Using TensorFlow backend.
Model Loaded.
Traceback (most recent call last):
face detected
File "/Users/Jason/ML/BossSensor/camera_reader.py", line 36, in
result = model.predict(image)
File "/Users/Jason/ML/BossSensor/boss_train.py", line 159, in predict
result = self.model.predict_proba(image)
File "/usr/local/lib/python2.7/site-packages/keras/models.py", line 758, in predict_proba
preds = self.predict(x, batch_size, verbose)
File "/usr/local/lib/python2.7/site-packages/keras/models.py", line 671, in predict
return self.model.predict(x, batch_size=batch_size, verbose=verbose)
File "/usr/local/lib/python2.7/site-packages/keras/engine/training.py", line 1161, in predict
check_batch_dim=False)
File "/usr/local/lib/python2.7/site-packages/keras/engine/training.py", line 108, in standardize_input_data
str(array.shape))
Exception: Error when checking : expected convolution2d_input_1 to have shape (None, 64, 64, 3) but got array with shape (1, 3, 64, 64)
Cleaned up camera.

I also have this error, how to resolve.

from bosssensor.

bpgergo avatar bpgergo commented on May 8, 2024

I also got this error. my image_dim_ordering is "tf". could it be the reason that I have different sized images in the training folders?

from bosssensor.

Related Issues (20)

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.