Code Monkey home page Code Monkey logo

Comments (11)

lanpa avatar lanpa commented on April 27, 2024 1

Yes, and please have a test on the function before PR.

from tensorboardx.

lucabergamini avatar lucabergamini commented on April 27, 2024

Ok, I think I understand what is happening. according to the tensorboard embedding doc

The sprite should have the same number of rows and columns

There is no such control in the code right now, and this explains why TB is link wrong images and labels (although it is a poor implementation from them to expect a squared image IMHO) . In fact if you:

  • Get the images number n_i
  • Find the minimum squared sprite dimensions which can hold the images using (int(ceil(n_i**0.5))))**2
  • Concat black images at the end of the valid images
  • Call make_grid using the square root size (which now does exist as integer)

Everything should works. You can see the different results for a batch of 10 images below
sprite

sprite

The first one produces wrong association, while the second one works!

from tensorboardx.

lanpa avatar lanpa commented on April 27, 2024

great!
But I think you should fix:
https://github.com/lanpa/tensorboard-pytorch/blob/master/tensorboard/embedding.py#L15
and make nrow correct.
Would you like to send a PR?

from tensorboardx.

lucabergamini avatar lucabergamini commented on April 27, 2024

I' m working on that function indeed. Just one question:

  • What is the use of xx?

from tensorboardx.

lanpa avatar lanpa commented on April 27, 2024

https://github.com/lanpa/tensorboard-pytorch/blob/master/tensorboard/embedding.py#L17

Just a dirty fix for torchvision. lol

from tensorboardx.

lucabergamini avatar lucabergamini commented on April 27, 2024

I make a PR as soon as I learn how it works :D

from tensorboardx.

lanpa avatar lanpa commented on April 27, 2024

changing nrow = int(math.floor(math.sqrt(label_img.size(0))))
to nrow = int(math.ceil(math.sqrt(label_img.size(0)))) would be OK. Am I right?

from tensorboardx.

lucabergamini avatar lucabergamini commented on April 27, 2024

no, beacuse you also have to concat black images to the original ones.
Should i fork the repo and then make a pr?

from tensorboardx.

lucabergamini avatar lucabergamini commented on April 27, 2024

I'm getting an unexpected behaviour...the label are linked correctly, but the images of the first column (except for the first element, i.e m[0,0] ) are shown as black. Any idea?

sprite

7 and 4 are black.

I've checked the dimension of the output of make_grid to find that somehow a pixel get append in both size, maybe the problem is there (which explain some of your fixes btw)

from tensorboardx.

lucabergamini avatar lucabergamini commented on April 27, 2024

Fixed and PR made :)

from tensorboardx.

lanpa avatar lanpa commented on April 27, 2024

Should work now. Thanks!

from tensorboardx.

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.