You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I would like to train a CNN-classifier with my custom data using the widely-used models like ResNet series,I found it is useful to initialize the model weights with ImageNet pretrained weights, and it is easy to implement with the torch::load API when the image channels of my dataset is 3, the same as ImageNet,under which situation no change should be made to the Conv1 layer.
It is the other situation when I try to train with gray images,as the Conv1 weights is supposed to be of in_channels=3, In the python fronten, I guess this maybe solved but imdieatly repalce the model.conv1 like this:
There is no doubt that your solution will work, I quite believe in that , but the solution seems to be sort of bypassing rather than solving. I think maybe it is not the right way using the C++ API while at the same time relying too much on the PYTHON parts. so, still, I am here asking for a solution absolutly within libtorch.
To my knowledge it is currently not possible to do this completely within C++, as torch::load() cannot load pickled weight files and there is also no load_state_dict() function for models in libtorch (see this recent issue in the official pytorch repo). Maybe you can find more information on this in the Pytorch forum or the official repo's issues.
Is your feature request related to a problem? Please describe.
but as for the C++ fronten, repalcing seems not work:
Describe the solution you'd like
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: