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

How to use dicom images for training? #1440

Closed
ghost opened this issue Nov 18, 2020 · 4 comments
Closed

How to use dicom images for training? #1440

ghost opened this issue Nov 18, 2020 · 4 comments
Labels
question Further information is requested

Comments

@ghost
Copy link

ghost commented Nov 18, 2020

How to use dicom images for training?❔

I'm using lung cancer images which is of the format of .dcm not .png or any other image format.
Is there any way to use .dcm images?

@ghost ghost added the question Further information is requested label Nov 18, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Nov 18, 2020

Hello @asim266, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook Open In Colab, Docker Image, and Google Cloud Quickstart Guide for example environments.

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 model or data training question, please note Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:

  • Cloud-based AI systems operating on hundreds of HD video streams in realtime.
  • Edge AI integrated into custom iOS and Android apps for realtime 30 FPS video inference.
  • Custom data training, hyperparameter evolution, and model exportation to any destination.

For more information please visit https://www.ultralytics.com.

@glenn-jocher
Copy link
Member

@asim266 I'm not familiar with that format, but if cv2 can read it you can add it to the dataloader acceptable formats list here:

yolov5/utils/datasets.py

Lines 24 to 28 in df0e408

# Parameters
help_url = 'https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data'
img_formats = ['bmp', 'jpg', 'jpeg', 'png', 'tif', 'tiff', 'dng'] # acceptable image suffixes
vid_formats = ['mov', 'avi', 'mp4', 'mpg', 'mpeg', 'm4v', 'wmv', 'mkv'] # acceptable video suffixes

@ghost
Copy link
Author

ghost commented Nov 18, 2020

@glenn-jocher .dcm is not supported by cv2 we need to convert the image from .dcm to cv2 supported format please check the link.
https://stackoverflow.com/questions/53707851/using-dicom-images-with-opencv-in-python
or by adding the following code in the dataset.py I guess.

import cv2 import pydicom as dicom ds = dicom.dcmread('sample.dcm') dcm_sample = ds.pixel_array * 128 cv2.imshow('sample image dicom', dcm_sample) cv2.waitKey()

@glenn-jocher
Copy link
Member

@asim266 since it's not supported your best best is to simply export all your images to jpg offline, and then present the jpg dataset for training.

This issue was closed.
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

1 participant