Comments (4)
Please provide more information such as how many cards are used for training.
This is a common general error, because adding module.*
to the key prefix.
You could try like this:
https://github.com/haomo-ai/MotionSeg3D/blob/dc4c95fcdba2f0819d2bbc4a419f231c55e9c6f3/modules/user.py#L63-L69
self.model = SalsaNextWithMotionAttention(self.parser.get_n_classes(), ARCH, num_batch=self.infer_batch_size)
self.model = nn.DataParallel(self.model)
checkpoint = "SalsaNextWithMotionAttention_refine_module_valid_best"
w_dict = torch.load(f"{self.modeldir}/{checkpoint}", map_location=lambda storage, loc: storage)
# self.model.load_state_dict(w_dict['main_state_dict'], strict=True)
self.model.load_state_dict({f"module.{k}":v for k,v in w_dict['main_state_dict'].items()}, strict=True)
from lidar-mos.
Thanks a lot my friend. It seems like we just need to make a little change to the original code in user.py:
line 64: self.model.load_state_dict(w_dict['state_dict'], strict=Ture) --> self.model.load_state_dict(w_dict['state_dict'], strict=False)
line 70: self.model.load_state_dict(w_dict['state_dict'], strict=Ture) --> self.model.load_state_dict(w_dict['state_dict'], strict=False)
I successfully solved this problem by making changes as shown above, and I hope it may help some other friends who also meet this problem.
from lidar-mos.
Hi, @silence-tang, I am very worried that if you use it like this, it will not load successfully.
The logic of strict=False
is to load values with equal keys. Although there is no error, it may not load any weight from the checkpoint.
As shown above, I think use this command is better, because strict=False is used directly, other key mismatches cannot be avoided, It is very likely that it did not load any weights from the checkpoint.
# self.model.load_state_dict(w_dict['main_state_dict'], strict=True)
self.model.load_state_dict({f"module.{k}":v for k,v in w_dict['main_state_dict'].items()}, strict=True)
from lidar-mos.
Thank you very much! @MaxChanger I just visualized the .label file generated by my method, but just as you said, it didn't load weight from the checkpoint and every point was labeled 9, which isn't what we expected. After applying the method you proposed, it finally worked in a proper way, thanks!
from lidar-mos.
Related Issues (20)
- How to train this code on multi-GPUs? HOT 4
- How to re-train when training is unexpectedly interrupted? HOT 8
- How to use the pretrained model to test my own Lidar Scans? HOT 5
- About set my own Lidar pose to kitti format pose HOT 3
- how to visualize? HOT 4
- How did you define the moving and static object HOT 4
- About using my own lidar data and lidar pose HOT 2
- Salsanext HOT 20
- 关于使用rangenet的问题 (Problem when using rangenet) HOT 4
- deployment
- Headless way to visualize the result? HOT 1
- About training time HOT 3
- moving and static object
- 在保存训练模型时遇到问题 (Problem while saving training model)
- Try with different sensor
- salsanext issue
- 请问如何对预训练模型进行微调?
- core dumped when infering with SalsaNext
- About the issue of multi-GPU training.
- ubuntu or windows HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lidar-mos.