-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
cp: cannot stat 'runs/detect/train/weights/last.pt': No such file or directory #956
Comments
👋 Hello @Ray150789, thank you for raising an issue about Ultralytics HUB 🚀! We're here to help. It looks like your training process has completed, but you're unable to locate the expected
For your retraining query, you should be able to use an An Ultralytics engineer will review your issue soon to provide more direct assistance. Thank you for your patience and for helping us improve Ultralytics HUB! 😊 |
@Ray150789 thank you for raising this issue! Let me help clarify and guide you through potential resolutions. The error Steps to Troubleshoot and Resolve:
Additional Notes:
If the issue persists, feel free to share additional details, such as training logs or dataset configuration, so we can assist further. Best of luck with your training, and I hope you achieve the desired results! 🚀 |
Thank you for the reply
I think that providing the facilities to train models is awesome
My PC specs:
Processor
Installed RAM 8,00 GB (7,88 GB usable)
System type 64-bit operating system, x64-based processor
Edition Windows 10 Pro
Version 22H2
Experience Windows Feature Experience Pack 1000.19060.1000.0
My ipynb file:
%pip install ultralytics
%pip install -U roboflow
# Get dataset
from roboflow import Roboflow
rf = Roboflow(api_key="BVsY1jgpRSprqMqvAQ5v")
project = rf.workspace("roboflow-jvuqo").project(
"football-players-detection-3zvbc")
version = project.version(1)
dataset = version.download("yolov5")
dataset.location
'c:\\Users\\User\\Football_project\\football_analysis\\training\\football-players-detection-1'
import shutil
shutil.move('football-players-detection-1/test',
'football-players-detection-1/football-players-detection-1/test'
)
shutil.move('football-players-detection-1/train',
'football-players-detection-1/football-players-detection-1/train')
shutil.move('football-players-detection-1/valid',
'football-players-detection-1/football-players-detection-1/valid')
'football-players-detection-1/football-players-detection-1/valid'
# Training
!yolo task=detect mode=train model=yolov5s.pt data={dataset.location}/data.yaml
epochs=100 imgsz=640
The last successfully completed training model ran with following:
!yolo task=detect mode=train model=yolov5s.pt
data={dataset.location}/data.yaml epochs=15 imgsz=640
Results saved to runs/detect/train
from google.colab import drive
drive.mount('/content/drive')
from google.colab import drive
drive.mount('/content/drive')
!cd /
!cp -R runs/detect/train/weights/last.pt drive/MyDrive/Colab\ Notebooks/
!cd /
!cp -R runs/detect/train/weights/best.pt drive/MyDrive/Colab\ Notebooks/
When I attempt to copy the files to the directory to make it work, it
outputs the error
cp: cannot stat 'runs/detect/train/weights/last.pt': No such file or
directory cp: cannot stat 'runs/detect/train/weights/best.pt': No such file
or directory
I initially used model=yolov5x but I did not get a successful output, I
attempted to lower the number of epochs to no avail.
The current code I'm working on uses a model=yolov5n epochs=50 but the
output video does not track the ball successfully enough.
Therefore I eventually attempted to use model=yolov5s epochs=15 which ran
successfully but I cant extract the data. 50 epochs and 30 epochs was too
large to run until completion. My data.yaml file:
path:
C:\Users\User\Football_project\football_analysis\training\football-players-detection-1\data.yaml
names:
- ball
- goalkeeper
- player
- referee
nc: 4
roboflow:
license: CC BY 4.0
project: football-players-detection-3zvbc
url:
https://universe.roboflow.com/roboflow-jvuqo/football-players-detection-3zvbc/dataset/1
version: 1
workspace: roboflow-jvuqo
test: ../test/images
train: football-players-detection-1/train/images
val: football-players-detection-1/valid/images
My yolo_inference file:
from ultralytics import YOLO
model = YOLO('models/best.pt')
results = model.predict('input_videos/08fd33_4.mp4', save=True)
print(results[0])
print('==================================')
for box in results[0].boxes:
print(box)
How do I annotate the images or videos again with corrected labels if
required.
I assume there is a problem saving the weights file.
I got 2 separate predict files in runs/detect/predict and
runs/detect/predict2 folder, they contain output videos, the first one
detects the ball for approx 5% of the video and detects referees as
players. The second output video detects the referees separate from players
but does not track the ball. I attached the videos as google drive links.
08fd33_4.avi
<https://drive.google.com/file/d/111mzZ1bNEDC2XCS6EFLboRscQgFz1k7Z/view?usp=drive_web>
08fd33_4.avi
<https://drive.google.com/file/d/1QOmdaP3Vs9QsuKtR88wBXJa1C9n-iLvq/view?usp=drive_web>
Regards Paula
Hopefully I provided enough insight into the issue.
…On Sun, Dec 22, 2024 at 3:49 AM Paula Derrenger ***@***.***> wrote:
@Ray150789 <https://github.com/Ray150789> thank you for raising this
issue! Let me help clarify and guide you through potential resolutions.
The error cp: cannot stat 'runs/detect/train/weights/last.pt': No such
file or directory usually indicates that the training process did not
generate a last.pt file. This could happen for several reasons, such as
improper termination of training or issues during the saving process.
Steps to Troubleshoot and Resolve:
1.
*Verify Training Completion:*
- Double-check the training logs to confirm that the training process
completed successfully. If there were any interruptions or errors, the
weights (last.pt and best.pt) might not have been saved.
2.
*Confirm Output Directory:*
- According to your description, results saved to runs/detect/train
suggests that the model outputs, including weights, should be in that
directory. Check the exact path:
runs/detect/train/weights/
If the folder exists but is empty, it indicates an issue with
saving the weights.
3.
*Output Videos in runs/detect/predict:*
- The runs/detect/predict folder contains results from inference runs,
not training. If you wish to retrain using those predictions, you'd need to
prepare a dataset from the output. This involves annotating the images or
videos again with corrected labels if required.
4.
*Retraining with Updated Parameters:*
- Yes, you can use the .ipynb notebook again to retrain the model.
Ensure that:
- You specify a valid dataset path in the data argument.
- Update training hyperparameters like epochs, lr0, or batch_size
to potentially improve the model's quality.
- Example:
from ultralytics import YOLOmodel = YOLO("yolov8n.pt") # Load a base model or your checkpointmodel.train(data="path/to/dataset.yaml", epochs=50, batch_size=16)
5.
*Ensure Latest Version:*
- Confirm that you are using the latest version of Ultralytics
packages. Run the following:
pip install ultralytics --upgrade
6.
*Check Disk Space:*
- Insufficient disk space might prevent saving weights. Verify that
you have enough storage available on your machine.
Additional Notes:
- If you encounter low-quality predictions, you may want to:
- Ensure your dataset is properly annotated and balanced.
- Train for more epochs or fine-tune the learning rate.
- Use a larger YOLO model (e.g., yolov8m.pt instead of yolov8n.pt)
for better accuracy.
- For running training on a lower-spec machine like yours, consider
reducing batch_size and enabling device='cpu' if GPU is unavailable.
If the issue persists, feel free to share additional details, such as
training logs or dataset configuration, so we can assist further. Best of
luck with your training, and I hope you achieve the desired results! 🚀
—
Reply to this email directly, view it on GitHub
<#956 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AILUVNU7FPFPK4ROXFC4CC32GYLDTAVCNFSM6AAAAABUAORKX6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNJYGI4TKOBRHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@Ray150789 hi Paula, Thank you for providing such detailed insight into your issue. Based on the information shared, I’ll address your concerns and guide you toward a resolution. 1. Missing
|
Search before asking
HUB Component
Training
Bug
My training completed but I cant find the best,pt file it says results saved to runs/detect/train my folders include runs/detect/predict which has output video files which I wish to retrain as the output has low quality output. Also can I use an ipynb again if I want to get a better trained model.
Environment
Device name DESKTOP-AM4RDAQ
Processor
Installed RAM 8,00 GB (7,88 GB usable)
Device ID 2C265D9F-7E3E-4D23-816A-85FFE62C5616
Product ID 00331-20020-00000-AA388
System type 64-bit operating system, x64-based processor
Pen and touch No pen or touch input is available for this display
Edition Windows 10 Pro
Version 22H2
Installed on 2023/10/09
OS build 19045.5247
Experience Windows Feature Experience Pack 1000.19060.1000.0
Minimal Reproducible Example
No response
Additional
No response
The text was updated successfully, but these errors were encountered: