Giter VIP home page Giter VIP logo

Comments (8)

zhixuan-lin avatar zhixuan-lin commented on September 18, 2024

Hi @bentennyson9x, z_where here refers to the bounding box. Its shape is (B, G*G, 4), where G*G is the number of cells (e.g., 4*4). z_where[:, :, :2] gives the size of the object (normalized to (0, 1)) and z_where[:, :, 2:] gives location (normalized to (-1, 1)). Since many of the cells won't contain valid objects, you also need z_pres here to determine which cells contain objects.

To convert z_where and z_pres (you should binarize z_pres before sending it in) into list of bounding boxes like [[(y_min, y_max, x_min, x_max)]] in pixel values, you can use the convert_to_bbox function here.

from space.

nguyendohoangkhoi avatar nguyendohoangkhoi commented on September 18, 2024

Thanks for your help! I got it

from space.

nguyendohoangkhoi avatar nguyendohoangkhoi commented on September 18, 2024

I got an error "IndexError: The shape of the mask [256, 1] at index 1 does not match the shape of the indexed tensor [256, 4] at index 1" when I passed convert_to_boxes(log.z_where,log.z_pres, log.z_pres_prob) to the "convert_to_boxes" function. I checked again and realized that log.z_pres always has a shape (256,1) (because sigmoid) while log.z_where shape is ([256, 4] with [sx, sy, tx, ty]. Am I missing something?

from space.

zhixuan-lin avatar zhixuan-lin commented on September 18, 2024

Ah sorry I forgot to mention this thing: you should squeeze z_pres and z_pres_prob from (B, N, 1) to (B, N) (i.e. z_pres.squeeze(2)) before sending them to convert_to_boxes as shown here

SPACE/src/eval/ap.py

Lines 39 to 40 in e1eaf4a

:param z_pres: (B, N) Must be binary and byte tensor
:param z_pres_prob: (B, N). In range (0, 1)

from space.

nguyendohoangkhoi avatar nguyendohoangkhoi commented on September 18, 2024

I got bad values of the bounding box. I think it is due to the binarizing z_pres in 0 and 1 value. I don't know the threshold to do it. Can you help me. z_pres values are in this picture when I print it out
image

from space.

zhixuan-lin avatar zhixuan-lin commented on September 18, 2024

A simple z_pres = z_pres > 0.5 should do. How did you binarize it? The result is supposed to be ByteTensor but what you show me seems to be FloatTensor.

from space.

nguyendohoangkhoi avatar nguyendohoangkhoi commented on September 18, 2024

Oh, I did it! Thank you very much. You save my day!

from space.

zhixuan-lin avatar zhixuan-lin commented on September 18, 2024

You're welcome :)

from space.

Related Issues (6)

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.