Git Product home page Git Product logo

Comments (4)

pierluigiferrari avatar pierluigiferrari commented on May 24, 2024

You don't need BatchGenerator to do that. Just pass the video frames to the model's predict() method.

from ssd_keras.

TanmoyDL avatar TanmoyDL commented on May 24, 2024

Thanks for your reply.
I have tried to test an image which is not belong to the validate dataset. Once, I am able to do that then I can pass the video frames into the model.predict(). I have tried as follows,
image_load=Image.open('./examples/bike.jpg')
image_load=np.asarray(image_load, dtype="float32")
test = BatchGenerator(filenames=image_load)
test_class = test.generate(batch_size=1,
train=False,
equalize=False,
brightness=False,
flip=False,
translate=False,
scale=False,
random_crop=False,
crop=False,
resize=False,
gray=False,
limit_boxes=True,
include_thresh=0.4,
diagnostics=False)

X, filenames = next(test_class)
i = 0
#Make a prediction
y_pred = model.predict(X)

The error is "ValueError: Found input variables with inconsistent numbers of samples: [1, 0]".

from ssd_keras.

pierluigiferrari avatar pierluigiferrari commented on May 24, 2024

I've already answered an almost identical question in #28.

Note that

  1. The filenames argument in the BatchGenerator constructor expects a list that contains the paths to the images, not the images themselves. So it would have to be image_load=['./examples/bike.jpg'].
  2. The first point also illustrates why it is unnecessary to use BatchGenerator here. You've already loaded the image with Image.open(), so why would you need to pass it to the batch generator? All you need to do is pass the loaded image to model.predict(). Be aware that model.predict() wants 4-dimensional input though, even if it is just one image, so if img is your image, the call has to be model.predict(np.array([img])), not model.predict(img).

from ssd_keras.

stale avatar stale commented on May 24, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from ssd_keras.

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.