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

How to load params and models from memory? #36

Closed
malegend opened this issue Oct 22, 2021 · 5 comments · Fixed by #39
Closed

How to load params and models from memory? #36

malegend opened this issue Oct 22, 2021 · 5 comments · Fixed by #39
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@malegend
Copy link

I want to put the models and params files into the project resources, and load them directly from memory.
Is there any way?
Thanks!

@takuya-takeuchi takuya-takeuchi self-assigned this Oct 22, 2021
@takuya-takeuchi takuya-takeuchi added enhancement New feature or request question Further information is requested labels Oct 22, 2021
@takuya-takeuchi
Copy link
Owner

@malegend
Now, it does not provide but ncnn looks like to provide this functions int load_param(const unsigned char* mem) and int load_model(const unsigned char* mem) .
https://github.com/Tencent/ncnn/blob/a08f700775e70c8ca6d141eac550e6f59f2cba5b/src/net.h#L100

@malegend
Copy link
Author

@malegend Now, it does not provide but ncnn looks like to provide this functions int load_param(const unsigned char* mem) and int load_model(const unsigned char* mem) . https://github.com/Tencent/ncnn/blob/a08f700775e70c8ca6d141eac550e6f59f2cba5b/src/net.h#L100

Thanks. And when will the memory version be available?

@takuya-takeuchi
Copy link
Owner

@malegend
I'm working on this issue but it may take more time.
Because load_model(const char* mem) does not copy argument. It stores only reference.
It means that loaded model may be corrupted after invoke load_model by GC.

So we have to implement DataReaderFromMemory.
But this class also stores only reference so it have it to be wrapped by wrapper class to copy memory.

@malegend
Copy link
Author

malegend commented Oct 27, 2021

@malegend I'm working on this issue but it may take more time. Because load_model(const char* mem) does not copy argument. It stores only reference. It means that loaded model may be corrupted after invoke load_model by GC.

So we have to implement DataReaderFromMemory. But this class also stores only reference so it have it to be wrapped by wrapper class to copy memory.

Thanks, FULL of expectation.

@takuya-takeuchi takuya-takeuchi linked a pull request Oct 30, 2021 that will close this issue
@malegend
Copy link
Author

malegend commented Nov 1, 2021

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants