Chart / graph library for pyTorch?

Is there a chart library module for pytorch which might allow for some of the functionality found in matplotlib?

I ask because I am currently using matplotlib to generate a radar chart, which I then use as a sample’s input image to my torch network. The matplotlib portion of this, creating a chart for each sample, is very slow and currently has a memory leak I can’t pin down. Ideally I would much prefer to be able to generate the chart images directly from the tensors.

For reference, here is a snapshot of 200 samples from my data set where I create an image to then use in a CNN.

I don’t know how the data is created but would assume that numpy is used under the hood. If so, you could check which numpy operators are used there and try to port them to PyTorch (assuming all operations are supported) and could then use a GPU.

That’s a good idea @ptrblck. I can get as far as using tensors to create the values being fed into the pyplot.plot() method, but I haven’t gone digging to figure out how it “fills in” the defined area. It seems like pytorch might be particularly well suited for some traditional graphics tasks so I had hope that someone might already have a library which could generate and render polygonal surfaces.

I’m not sure if PyTorch’s strength could shine in filling polygons, if you don’t need to differentiate through these operations (assuming they are even differentiable). You could take a look at e.g. Kornia which might provide similar methods already. CC @edgarriba

Kornia looks interesting. I’ve also found VisPy which looks like it might be a good solution for using the GPU to turn my data into images, but the documentation is very lacking and may still be too early in development to actually get something working.

If anyone else has experience with techniques for converting data into an image to be used with pyTorch training I would love to investigate. Unfortunately my data set is far too large to pre-convert the data, so it needs to be done with the loader and collate_fn. keeping the data on the GPU is the most ideal solution.

we have added recently some drawing utilities in kornia. See e.g draw_line or draw_rectangle.

We still miss fill polygon – contributions are welcomed :slight_smile: