Comments (3)
Hello! It looks like you're trying to train a new network structure using pre-existing weights. If your model reverts to the original structure during training, it might be due to the way the weights are being loaded. Ensure that the weights are compatible with the new model structure, and check if the model definition in your training script correctly reflects the new architecture.
Here's a quick example of how you can load the weights:
from ultralytics import YOLO
# Load your custom model architecture
model = YOLO('path/to/new_model.yaml')
# Load weights from the old model
model.load('path/to/old_weights.pt', strict=False) # Use strict=False to allow mismatch
# Now you can proceed with training
model.train('data.yaml', epochs=100)
Make sure that the strict=False
parameter is used to allow for the size mismatches between the new model and the old weights. This should help in adapting the old weights to your new structure without forcing the architecture to revert. If you continue to experience issues, double-check the architecture changes and ensure they are saved correctly.
from ultralytics.
load() got an unexpected keyword argument 'strict',but in the function, it set strict=False default when call torch.load.
I use model.load('path/to/old_weights.pt'), it works.
Thank you for your help. ~~
from ultralytics.
@TonightGo hello! I'm glad to hear that using model.load('path/to/old_weights.pt')
worked out for you. It seems there was a misunderstanding regarding the strict
parameter; it's not directly used in the model.load()
method for YOLOv8. The method handles the loading process internally, including any necessary adjustments for weight compatibility. If you have any more questions or need further assistance, feel free to ask. Happy coding! 😊
from ultralytics.
Related Issues (20)
- scipy or lap.lapjv? HOT 2
- Result of Yolo model differs between PIL.Image and numpy array HOT 4
- Pose detection tf-life yolov8 - using int8 weights. HOT 2
- Error with Custom Trained YOLOV10 Model: 'dict' object has no attribute 'shape' HOT 3
- Could a PR curve be generated based on the training set? HOT 1
- problem with multiGPU HOT 3
- RuntimeError: scatter(): Expected dtype int64 for index HOT 2
- [¡Pelisplus! ]-Ver Del revés 2 (Inside Out 2) (2024) Pelicula Completa Online en Español y Latino HD HOT 2
- gjxfjxft HOT 2
- [VER!!] Del revés 2 (Inside Out 2) 2024 ESPAÑOL Y LATINO — CUEVANA 3 HOT 2
- CUEVANA.3 VER Del revés 2 (Inside Out 2) (2024) Película completa en Español y Latino HOT 2
- [¡Pelisplus! ]-Ver Del revés 2 (Inside Out 2) (2024) Pelicula Completa Online en Español y Latino HD HOT 1
- Will Train Image Sizes Impact prediction on high quality images HOT 3
- Model Failed to Predict the Correct Class using One-Class HOT 3
- Inconsistencies with `max_det` HOT 2
- Metrics for test data HOT 3
- RuntimeError: torch.cat(): expected a non-empty list of Tensors HOT 4
- How to evaluate loss in.val mode HOT 2
- Are there any Yolov8 Pose model implmentation with coreml? HOT 2
- Reducing CPU consumption when running multiple instances of YOLOv8 using multithreading and multiprocessing HOT 5
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 ultralytics.