Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is have example on a real corpus? #3

Open
faranaziz opened this issue Jun 6, 2021 · 11 comments
Open

Is have example on a real corpus? #3

faranaziz opened this issue Jun 6, 2021 · 11 comments

Comments

@faranaziz
Copy link

Dear team,
thanks you for great project!
I try write data loader in C++ for training, but not much success. Did you try this code on an open source DB?

@divideconcept
Copy link
Owner

Hi, I would not waste to much time with the C++ dataset loader and would instead write my own C++ tensor loading routine.
There's a very useful function in libtorch : torch::from_blob(). It allows you to load any C++ array into a PyTorch tensor.
It works like this: torch::from_blob(pointerToFloatDataArray,{dimension1,dimension2,...});

@faranaziz
Copy link
Author

OK,
Thanks. You use it to load PNG / JPEG images that you first read into a C++ array?

@divideconcept
Copy link
Owner

I use it with spectrograms data but yes that's the same principle. If you want to use it with pictures, you would have to load your png/jpeg images into c++ memory arrays (using functions not provided with libtorch) and then upload those arrays to pytorch tensors using torch::from_blob.

Pseudo-code for one image would be something like that:
char* rgbArray=loadImage(...);
torch::Tensor imgTensor = torch::from_blob(rgbArray, {channels, width, height}, torch::kFloat);

@faranaziz
Copy link
Author

Thanks!
You generate the spectrograms offline using Python (npy) and then read them from C++?

@divideconcept
Copy link
Owner

I generate spectrograms in real time directly in C++. I've created this library for my software SpectraLayers.

@faranaziz
Copy link
Author

Library looks amazing. Does it only work as a plug-in?

@faranaziz
Copy link
Author

And you use U-net for process spectograms?

@divideconcept
Copy link
Owner

If you're referring to SpectraLayers, it's both a plugin and a stand-alone application.
I indeed use U-Net for several spectrogram processing (for most AI-driven processes, actually).

@faranaziz
Copy link
Author

Yes,
I register on steinberg but no can download. Will try again later.

@divideconcept
Copy link
Owner

You can download SpectraLayers directly from here:
https://www.steinberg.net/en/support/downloads/downloads_spectralayers_7.html

@faranaziz
Copy link
Author

Thanks!
How did you read a wav file into a torch::tensor? Using any third party? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants