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)
- When will it be online to train its own target tracking dataset? HOT 1
- INT8 calibration set clarification HOT 1
- Label is not detecting HOT 3
- Implementing Custom Transfer learning HOT 11
- Multi GPU training error
- gradio interface cannot play a detected video HOT 3
- yolov8 trt exporting question HOT 2
- tensorRT export type question HOT 5
- Why do GPU_mem, parameters, GFLOPs of YOLOv8 vary depending on the datasets? HOT 3
- Need Help: YOLO Model Predicts Zero Objects After Training (Beginner) HOT 2
- yolov8n onnx model outputs [1, 84, 8400 ] when using with onnxruntime HOT 10
- to combine 2 models with different classes with transfer learning HOT 7
- model track always after detect, can i detect once and just use tracker to get next frames boxes? HOT 4
- How would I go converting the model to tfjs HOT 6
- yolov8-redetr HOT 3
- Which epoch is best.pt? HOT 6
- Yolo V8 tflite conversion HOT 2
- `Results.summary()` leads to `IndexError` for FastSAM results filtered down to 1 item via point prompt HOT 2
- voc.yaml to instance segmentation HOT 6
- Check classes from onnx version of yolov8 (custom trained). HOT 2
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.