Git Product home page Git Product logo

Comments (4)

sirtris avatar sirtris commented on July 30, 2024

I had the same error. I think is because the pred_blobs are of shape [num_classes, img_width, img_height] and the ´image_raw´ is of shape [img_width, img_height, 3] so there is a shape mismatch.
What I did was: pred_blobs_max = np.argmax(pred_blobs, axis=0) and the replace pred_blobs with pred_blobs_max in the imsave line.

However my predictions are very bad I am not sure if I made a mistake here or somewhere else.
Does this solution work for you?

from lcfcn.

ThanhNguyenFG avatar ThanhNguyenFG commented on July 30, 2024

Thank you very much,
I fixed and no longer have this error, but the result is exactly what you said (it is very bad) and predict_count is always equal to 0 although blobs has appeared on the image.
.

from lcfcn.

tongpinmo avatar tongpinmo commented on July 30, 2024

@ThanhNguyenFG @sirtris
I have also come accross the problem, according to your method, I fixed my problem, but the result is so strange, my predict_count is normal but the coordinates is on the top of images

from lcfcn.

datkungfu avatar datkungfu commented on July 30, 2024

@ThanhNguyenFG @sirtris @tongpinmo I have found out the problem with this code. In the file applyOnImage.py you can see the line "pred_counts = int(model.predict(batch, method="counts").ravel()[0])"
But actually, it should become pre_counts= model.predict(batch, method="counts").ravel()
Then, you can add "print(pre_counts)" right after that line and then when we run the file main.py , the result of "print(pre_counts)" would be an array of 20 numbers, they are the number of objects for each class in 20 classes:
"aeroplane":0,
"bicycle":1,
"bird":2,
"boat":3,
"bottle":4,
"bus":5,
"car":6,
"cat":7,
"chair":8,
"cow":9,
"diningtable":10,
"dog":11,
"horse":12,
"motorbike":13,
"person":14,
"pottedplant":15,
"sheep":16,
"sofa":17,
"train":18,
"tvmonitor":19
In the code, author just count the number of object of the first class, "aeroplane".
Next, when we use pred_blob_max as @sirtris , then it would create the density map for the class with highest number of object.

from lcfcn.

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.