10000 Issue with Tellu Organoid Classifier using Yolov5 · Issue #13539 · ultralytics/yolov5 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Issue with Tellu Organoid Classifier using Yolov5 #13539

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

Open
1 task done
djtigani opened this issue Mar 21, 2025 · 4 comments
Open
1 task done

Issue with Tellu Organoid Classifier using Yolov5 #13539

djtigani opened this issue Mar 21, 2025 · 4 comments
Labels
detect Object Detection issues, PR's question Further information is requested

Comments

@djtigani
Copy link

Search before asking

Question

I am having this issue with Tellu Intestinal Organoid Classifier https://colab.research.google.com/drive/1j-jutA52LlPuB4WGBDaoAhimqXC3xguX?usp=sharing

Has worked perfectly before, but know I cannot get this code to run. any help would be appreciated, thanks.

detect: weights=['/content/yolov5/TelluWeights.pt'], source=/content/drive/MyDrive/BlatchleyLab/Projects/Role_of_integrins_in_symmetry_breaking/241217_DJT_SC_Rac1i_p30/D4, data=data/coco128.yaml, imgsz=[640, 640], conf_thres=0.35, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=True, save_conf=True, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs/detect, name=D4, exist_ok=False, line_thickness=3, hide_labels=True, hide_conf=False, half=False, dnn=False, vid_stride=1
YOLOv5 🚀 v7.0-0-g915bbf29 Python-3.11.11 torch-2.6.0+cu124 CPU

Traceback (most recent call last):
File "/content/yolov5/detect.py", line 259, in
main(opt)
File "/content/yolov5/detect.py", line 254, in main
run(**vars(opt))
File "/usr/local/lib/python3.11/dist-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/content/yolov5/detect.py", line 96, in run
model = DetectMultiBackend(weights, device=device, dnn=dnn, data=data, fp16=half)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/content/yolov5/models/common.py", line 345, in init
model = attempt_load(weights if isinstance(weights, list) else w, device=device, inplace=True, fuse=fuse)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/content/yolov5/models/experimental.py", line 79, in attempt_load
ckpt = torch.load(attempt_download(w), map_location='cpu') # load
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/torch/serialization.py", line 1470, in load
raise pickle.UnpicklingError(_get_wo_message(str(e))) from None
_pickle.UnpicklingError: Weights only load failed. This file can still be loaded, to do so you have two options, do those steps only if you trust the source of the checkpoint.
(1) In PyTorch 2.6, we changed the default value of the weights_only argument in torch.load from False to True. Re-running torch.load with weights_only set to False will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
(2) Alternatively, to load with weights_only=True please check the recommended steps in the following error message.
WeightsUnpickler error: Unsupported global: GLOBAL models.yolo.Model was not an allowed global by default. Please use torch.serialization.add_safe_globals([Model]) or the torch.serialization.safe_globals([Model]) context manager to allowlist this global if you trust this class/function.

Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html.
\nThe script also accepts other parameters. See https://github.com/ultralytics/yolov5/blob/master/detect.py for all the options.\n --max-detect 1000. Default is 1000; if you require more, add the parameter to the line of code above with a different value.\n --hide-labels Adding this parameter will hide the name of the organoid class detected in the result images. Convenient in dense cultures and for publication purposes\n\nExample:\n!python detect.py --weights $tellu --conf 0.35 --source $dir --save-txt --save-conf --name "results" --hide-labels --max-detect 2000\n

Additional

No response

@djtigani djtigani added the question Further information is requested label Mar 21, 2025
@UltralyticsAssistant UltralyticsAssistant added the detect Object Detection issues, PR's label Mar 21, 2025
@UltralyticsAssistant
Copy link
Member

👋 Hello @djtigani, thank you for reaching out and for using YOLOv5 🚀!

It seems you're encountering an issue with your Tellu Intestinal Organoid Classifier setup. To assist further, could you please provide a minimum reproducible example (MRE)? This will help us debug the issue more effectively. Specifically, please include:

  1. A clear description of your environment (e.g., Python version, PyTorch version, and any specific configurations you've set up).
  2. The exact commands or code snippets you are running.
  3. A sample of your input data or a detailed description of its structure (if applicable).
  4. Steps you've already tried to resolve the issue.

In the meantime, here are a few resources and steps that may help:

Requirements

Ensure your environment meets the following:

To set up, run:

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Common Troubleshooting

  • Make sure your weights file (TelluWeights.pt) is compatible with the current YOLOv5 version you are using. If you are using older weights, consider updating them or reverting to a compatible YOLOv5 version.
  • Check the PyTorch version installed in your environment. The error suggests a change in torch.load behavior. You may need to adjust the weights_only parameter or follow the recommendations in PyTorch's documentation.
  • If you suspect a corrupted weights file, try re-downloading it.

Environments

YOLOv5 is verified to work in environments like:

Status

Check if all YOLOv5 CI tests are passing:
YOLOv5 CI

If this badge is green, YOLOv5 tests for training, validation, inference, export, and benchmarks are all passing on macOS, Windows, and Ubuntu.

This is an automated response to help guide you. A member of the Ultralytics team will review your issue and assist you further as soon as possible. Thanks for your patience! 😊

@pderrenger
Copy link
Member

@djtigani this error occurs due to PyTorch 2.6's new security restrictions in torch.load(). Let's fix it with these steps:

  1. Update YOLOv5: First ensure you're using the latest YOLOv5 code:
!git pull  # in your yolov5 directory
  1. PyTorch Version: Either:
  • Downgrade PyTorch:
!pip install torch==2.0.1  # compatible version
  • Or modify your environment to trust the weights file (only if you fully trust the model source)

For full Google Colab setup guidance, see our Training custom datasets with Ultralytics YOLOv8 in Google Colab guide which covers similar environment configuration steps. Let us know if you still encounter issues after trying these solutions! 🚀

@djtigani
Copy link
Author

@pderrenger Hi! thank for the advice. Where should I run the code provided in the googlecolab (https://colab.research.google.com/drive/1j-jutA52LlPuB4WGBDaoAhimqXC3xguX?usp=sharing)

I tried running it after 1.2 and then got this result:

Image

You are not currently on a branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

git pull <remote> <branch>

Collecting torch==2.0.1
Downloading torch-2.0.1-cp311-cp311-manylinux1_x86_64.whl.metadata (24 kB)
Requirement already satisfied: filelock in /usr/local/lib/python3.11/dist-packages (from torch==2.0.1) (3.18.0)
Requirement already satisfied: typing-extensions in /usr/local/lib/python3.11/dist-packages (from torch==2.0.1) (4.12.2)
Requirement already satisfied: sympy in /usr/local/lib/python3.11/dist-packages (from torch==2.0.1) (1.13.1)
Requirement already satisfied: networkx in /usr/local/lib/python3.11/dist-packages (from torch==2.0.1) (3.4.2)
Requirement already satisfied: jinja2 in /usr/local/lib/python3.11/dist-packages (from torch==2.0.1) (3.1.6)
Collecting nvidia-cuda-nvrtc-cu11==11.7.99 (from torch==2.0.1)
Downloading nvidia_cuda_nvrtc_cu11-11.7.99-2-py3-none-manylinux1_x86_64.whl.metadata (1.5 kB)
Collecting nvidia-cuda-runtime-cu11==11.7.99 (from torch==2.0.1)
Downloading nvidia_cuda_runtime_cu11-11.7.99-py3-none-manylinux1_x86_64.whl.metadata (1.6 kB)
Collecting nvidia-cuda-cupti-cu11==11.7.101 (from torch==2.0.1)
Downloading nvidia_cuda_cupti_cu11-11.7.101-py3-none-manylinux1_x86_64.whl.metadata (1.6 kB)
Collecting nvidia-cudnn-cu11==8.5.0.96 (from torch==2.0.1)
Downloading nvidia_cudnn_cu11-8.5.0.96-2-py3-none-manylinux1_x86_64.whl.metadata (1.6 kB)
Collecting nvidia-cublas-cu11==11.10.3.66 (from torch==2.0.1)
Downloading nvidia_cublas_cu11-11.10.3.66-py3-none-manylinux1_x86_64.whl.metadata (1.6 kB)
Collecting nvidia-cufft-cu11==10.9.0.58 (from torch==2.0.1)
Downloading nvidia_cufft_cu11-10.9.0.58-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)
Collecting nvidia-curand-cu11==10.2.10.91 (from torch==2.0.1)
Downloading nvidia_curand_cu11-10.2.10.91-py3-none-manylinux1_x86_64.whl.metadata (1.6 kB)
Collecting nvidia-cusolver-cu11==11.4.0.1 (from torch==2.0.1)
Downloading nvidia_cusolver_cu11-11.4.0.1-2-py3-none-manylinux1_x86_64.whl.metadata (1.6 kB)
Collecting nvidia-cusparse-cu11==11.7.4.91 (from torch==2.0.1)
Downloading nvidia_cusparse_cu11-11.7.4.91-py3-none-manylinux1_x86_64.whl.metadata (1.6 kB)
Collecting nvidia-nccl-cu11==2.14.3 (from torch==2.0.1)
Downloading nvidia_nccl_cu11-2.14.3-py3-none-manylinux1_x86_64.whl.metadata (1.8 kB)
Collecting nvidia-nvtx-cu11==11.7.91 (from torch==2.0.1)
Downloading nvidia_nvtx_cu11-11.7.91-py3-none-manylinux1_x86_64.whl.metadata (1.7 kB)
Collecting triton==2.0.0 (from torch==2.0.1)
Downloading triton-2.0.0-1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (1.0 kB)
Requirement already satisfied: setuptools in /usr/local/lib/python3.11/dist-packages (from nvidia-cublas-cu11==11.10.3.66->torch==2.0.1) (75.1.0)
Requirement already satisfied: wheel in /usr/local/lib/python3.11/dist-packages (from nvidia-cublas-cu11==11.10.3.66->torch==2.0.1) (0.45.1)
Requirement already satisfied: cmake in /usr/local/lib/python3.11/dist-packages (from triton==2.0.0->torch==2.0.1) (3.31.6)
Collecting lit (from triton==2.0.0->torch==2.0.1)
Downloading lit-18.1.8-py3-none-any.whl.metadata (2.5 kB)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.11/dist-packages (from jinja2->torch==2.0.1) (3.0.2)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in /usr/local/lib/python3.11/dist-packages (from sympy->torch==2.0.1) (1.3.0)
Downloading torch-2.0.1-cp311-cp311-manylinux1_x86_64.whl (619.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 619.9/619.9 MB 2.2 MB/s eta 0:00:00
Downloading nvidia_cublas_cu11-11.10.3.66-py3-none-manylinux1_x86_64.whl (317.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 317.1/317.1 MB 4.5 MB/s eta 0:00:00
Downloading nvidia_cuda_cupti_cu11-11.7.101-py3-none-manylinux1_x86_64.whl (11.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.8/11.8 MB 96.7 MB/s eta 0:00:00
Downloading nvidia_cuda_nvrtc_cu11-11.7.99-2-py3-none-manylinux1_x86_64.whl (21.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 21.0/21.0 MB 67.2 MB/s eta 0:00:00
Downloading nvidia_cuda_runtime_cu11-11.7.99-py3-none-manylinux1_x86_64.whl (849 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 849.3/849.3 kB 51.4 MB/s eta 0:00:00
Downloading nvidia_cudnn_cu11-8.5.0.96-2-py3-none-manylinux1_x86_64.whl (557.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 557.1/557.1 MB 3.1 MB/s eta 0:00:00
Downloading nvidia_cufft_cu11-10.9.0.58-py3-none-manylinux2014_x86_64.whl (168.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 168.4/168.4 MB 7.2 MB/s eta 0:00:00
Downloading nvidia_curand_cu11-10.2.10.91-py3-none-manylinux1_x86_64.whl (54.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 54.6/54.6 MB 12.6 MB/s eta 0:00:00
Downloading nvidia_cusolver_cu11-11.4.0.1-2-py3-none-manylinux1_x86_64.whl (102.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 102.6/102.6 MB 8.2 MB/s eta 0:00:00
Downloading nvidia_cusparse_cu11-11.7.4.91-py3-none-manylinux1_x86_64.whl (173.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 173.2/173.2 MB 6.9 MB/s eta 0:00:00
Downloading nvidia_nccl_cu11-2.14.3-py3-none-manylinux1_x86_64.whl (177.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 177.1/177.1 MB 8.3 MB/s eta 0:00:00
Downloading nvidia_nvtx_cu11-11.7.91-py3-none-manylinux1_x86_64.whl (98 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.6/98.6 kB 8.6 MB/s eta 0:00:00
Downloading triton-2.0.0-1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (63.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 63.3/63.3 MB 12.0 MB/s eta 0:00:00
Downloading lit-18.1.8-py3-none-any.whl (96 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 96.4/96.4 kB 8.9 MB/s eta 0:00:00
Installing collected packages: lit, nvidia-nvtx-cu11, nvidia-nccl-cu11, nvidia-cusparse-cu11, nvidia-curand-cu11, nvidia-cufft-cu11, nvidia-cuda-runtime-cu11, nvidia-cuda-nvrtc-cu11, nvidia-cuda-cupti-cu11, nvidia-cublas-cu11, nvidia-cusolver-cu11, nvidia-cudnn-cu11, triton, torch
Attempting uninstall: triton
Found existing installation: triton 3.2.0
Uninstalling triton-3.2.0:
Successfully uninstalled triton-3.2.0
Attempting uninstall: torch
Found existing installation: torch 2.6.0+cu124
Uninstalling torch-2.6.0+cu124:
Successfully uninstalled torch-2.6.0+cu124
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
torchaudio 2.6.0+cu124 requires torch==2.6.0, but you have torch 2.0.1 which is incompatible.
torchvision 0.21.0+cu124 requires torch==2.6.0, but you have torch 2.0.1 which is incompatible.
Successfully installed lit-18.1.8 nvidia-cublas-cu11-11.10.3.66 nvidia-cuda-cupti-cu11-11.7.101 nvidia-cuda-nvrtc-cu11-11.7.99 nvidia-cuda-runtime-cu11-11.7.99 nvidia-cudnn-cu11-8.5.0.96 nvidia-cufft-cu11-10.9.0.58 nvidia-curand-cu11-10.2.10.91 nvidia-cusolver-cu11-11.4.0.1 nvidia-cusparse-cu11-11.7.4.91 nvidia-nccl-cu11-2.14.3 nvidia-nvtx-cu11-11.7.91 torch-2.0.1 triton-2.0.0
WARNING: The following packages were previously imported in this runtime:
[torch,torchgen]
You must restart the runtime in order to use newly installed versions.

when I restart the session i am unable to run Tellu (step 3)

python3: can't open file '/content/detect.py': [Errno 2] No such file or directory
\nThe script also accepts other parameters. See https://github.com/ultralytics/yolov5/blob/master/detect.py for all the options.\n --max-detect 1000. Default is 1000; if you require more, add the parameter to the line of code above with a different value.\n --hide-labels Adding this parameter will hide the name of the organoid class detected in the result images. Convenient in dense cultures and for publication purposes\n\nExample:\n!python detect.py --weights $tellu --conf 0.35 --source $dir --save-txt --save-conf --name "results" --hide-labels --max-detect 2000\n

@pderrenger
Copy link
Member

To resolve the PyTorch version conflict and missing detect.py error in Google Colab, follow these steps:

  1. Fresh Start: Click Runtime → Disconnect and delete runtime, then reconnect
  2. Proper Setup:
!git clone https://github.com/ultralytics/yolov5  # clone repo
%cd yolov5  # enter directory
!pip install -qr requirements.txt  # install dependencies
  1. Run Detection:
!python detect.py --weights /content/yolov5/TelluWeights.pt --conf 0.35 --source /content/your/source/dir

This maintains PyTorch 2.6 compatibility while ensuring proper file paths. For Colab environment setup guidance, see our Training custom datasets in Google Colab guide. Let me know if issues persist! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
detect Object Detection issues, PR's question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants
0