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

Caching images problem #1862

Closed
Bilgee opened this issue Jan 7, 2021 · 6 comments
Closed

Caching images problem #1862

Bilgee opened this issue Jan 7, 2021 · 6 comments

Comments

@Bilgee
Copy link

Bilgee commented Jan 7, 2021

I am trying to train a detection model using my custom dataset.
When I set image-size at 640, it works. But when I set mage-size at 1280, it shows the following error. I already tried --workers 0, but there was no difference.
yolov5: v4.0
env: google colab

Transferred 500/506 items from yolov5m.pt
Scaled weight_decay = 0.0005
Optimizer groups: 86 .bias, 86 conv.weight, 83 other
Scanning '/content/fish/labels/train.cache' for images and labels... 2368 found, 0 missing, 0 empty, 0 corrupted: 100% 2368/2368 [00:00<00:00, 26000292.86it/s]
Caching images (6.5GB): 100% 2368/2368 [04:12<00:00, 9.37it/s]
Scanning '/content/fish/labels/val.cache' for images and labels... 591 found, 0 missing, 0 empty, 0 corrupted: 100% 591/591 [00:00<00:00, 4063661.74it/s]
Caching images (1.3GB): 77% 458/591 [00:56<00:14, 9.14it/s]Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/pool.py", line 720, in next
item = self._items.popleft()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "train.py", line 520, in
train(hyp, opt, device, tb_writer, wandb)
File "train.py", line 202, in train
rank=-1, world_size=opt.world_size, workers=opt.workers, pad=0.5)[0]
File "/content/yolov5/utils/datasets.py", line 71, in create_dataloader
image_weights=image_weights)
File "/content/yolov5/utils/datasets.py", line 432, in init
for i, x in pbar:
File "/usr/local/lib/python3.6/dist-packages/tqdm/std.py", line 1104, in iter
for obj in iterable:
File "/usr/lib/python3.6/multiprocessing/pool.py", line 724, in next
self._cond.wait(timeout)
File "/usr/lib/python3.6/threading.py", line 295, in wait
waiter.acquire()
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/signal_handling.py", line 66, in handler
_error_if_any_worker_fails()
RuntimeError: DataLoader worker (pid 1192) is killed by signal: Killed.
Caching images (1.3GB): 77% 458/591 [00:58<00:17, 7.77it/s]

@Bilgee Bilgee added the bug Something isn't working label Jan 7, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2021

👋 Hello @Bilgee, 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 glenn-jocher removed the bug Something isn't working label Jan 7, 2021
@glenn-jocher
Copy link
Member

@Bilgee don't --cache if your system doesn't have the RAM to support it.

@Bilgee
Copy link
Author

Bilgee commented Jan 8, 2021

@glenn-jocher thank you for reply. Yolov5 caching is memory caching? I think that caching makes special files like tfrecords, right?

Scanning '/content/fish/labels/train.cache' for images and labels... 2368 found, 0 missing, 0 empty, 0 corrupted: 100% 2368/2368 [00:00<00:00, 26000292.86it/s]
Caching images (6.5GB): 100% 2368/2368 [04:12<00:00, 9.37it/s]
Scanning '/content/fish/labels/val.cache' for images and labels... 591 found, 0 missing, 0 empty, 0 corrupted: 100% 591/591 [00:00<00:00, 4063661.74it/s]
Caching images (1.3GB): 77% 458/591 [00:56<00:14, 9.14it/s]Traceback (most recent call last):

it failed here. Google Colab RAM is almost 13GB.

@Bilgee
Copy link
Author

Bilgee commented Jan 8, 2021

I think that after creating train.cache or val.cache, the code does not release memory, so that it fails to allocate the more memory.

@Bilgee
Copy link
Author

Bilgee commented Jan 8, 2021

@glenn-jocher

@phantom-cloud
Copy link

Try setting the image size between 640 and 1000 seems you are low on memory

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

No branches or pull requests

3 participants