Skip to content
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

yolov5: save weight during training in Google Drive #2308

Closed
Leprechault opened this issue Feb 26, 2021 · 6 comments
Closed

yolov5: save weight during training in Google Drive #2308

Leprechault opened this issue Feb 26, 2021 · 6 comments
Labels
question Further information is requested

Comments

@Leprechault
Copy link

Hi Everyone!
I'd like to save yolov5 (https://github.com/ultralytics/yolov5 repo) weight during training to backup folder in Google Drive in Google Colab, but if I try to:

from google.colab import drive
drive.mount('/content/drive', force_remount=True)
!rm /content/yolov5/yolov5/weights -r
!ln -s /content/drive/'My Drive'/backup 

The output is:

rm: cannot remove '/content/yolov5/yolov5/weights': No such file or directory

Please, any ideas for solve this?

@Leprechault Leprechault added the question Further information is requested label Feb 26, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Feb 26, 2021

👋 Hello @Leprechault, thank you for your interest in 🚀 YOLOv5! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.

If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.

For business inquiries or professional support requests please visit https://www.ultralytics.com or email Glenn Jocher at glenn.jocher@ultralytics.com.

Requirements

Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7. To install run:

$ pip install -r requirements.txt

Environments

YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

CI CPU testing

If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu every 24 hours and on every commit.

@glenn-jocher
Copy link
Member

@Leprechault you may have mixed up your paths. You can use the fileviewer on the left side of the Colab window to see your directory structure, including any mounted drives.

@Leprechault
Copy link
Author

Thanks Glenn, I find in an another post that you comment in : (#640), where
@TaoXieSZ give an improvement to save checkpoints with the addiction in lines 458 to 464 modified for my with backup folder in Google Drive in train.py:

   if not opt.evolve:
        tb_writer = None
        if opt.local_rank in [-1, 0]:
           # Change the path here
            tb_writer = SummaryWriter(log_dir=increment_dir('/content/drive/My Drive/backup', opt.name))
        train(hyp, opt, device, tb_writer)

But is not so clear the exact position eg. before # Set DDP variables or after # Resume in the train.py code. Could help me please again?

@glenn-jocher
Copy link
Member

@Leprechault you can save checkpoints anywhere you want using the --project and --name arguments:

python train.py --project PROJECT --name NAME
saves to
./PROJECT/NAME

@Leprechault
Copy link
Author

Thanks again @glenn-jocher Works very well!!!!

@pillai-karthik
Copy link

Example:
!python train.py --img 416 --batch 16 --epochs 100 --data '../data.yaml' --cfg ./models/custom_yolov5s.yaml --weights '' --name yolov5s_results --cache --project '../gdrive/MyDrive/' --name 'backup'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants