Empezar

Información general sobre los conjuntos de datos de detección de objetos

Para entrenar un modelo robusto y preciso de detección de objetos, necesitas un conjunto de datos completo. Esta guía presenta varios formatos de conjuntos de datos compatibles con el modelo Ultralytics YOLO y ofrece información sobre su estructura, uso y conversión entre formatos.

Formatos de conjuntos de datos compatibles#

Formato Ultralytics YOLO#

El formato Ultralytics YOLO es un formato de configuración de conjuntos de datos que te permite definir el directorio raíz del conjunto de datos, las rutas relativas a los directorios de imágenes de entrenamiento/validación/prueba o a los archivos *.txt que contienen rutas de imágenes, y un diccionario de nombres de clases. Aquí tienes un ejemplo:

ultralytics/cfg/datasets/coco8.yaml
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license

# COCO8 dataset (first 8 images from COCO train2017) by Ultralytics
# Documentation: https://docs.ultralytics.com/datasets/detect/coco8
# Example usage: yolo train data=coco8.yaml
# parent
# ├── ultralytics
# └── datasets
#     └── coco8 ← downloads here (1 MB)

# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
path: coco8 # dataset root dir
train: images/train # train images (relative to 'path') 4 images
val: images/val # val images (relative to 'path') 4 images
test: # test images (optional)

# Classes
names:
  0: person
  1: bicycle
  2: car
  3: motorcycle
  4: airplane
  5: bus
  6: train
  7: truck
  8: boat
  9: traffic light
  10: fire hydrant
  11: stop sign
  12: parking meter
  13: bench
  14: bird
  15: cat
  16: dog
  17: horse
  18: sheep
  19: cow
  20: elephant
  21: bear
  22: zebra
  23: giraffe
  24: backpack
  25: umbrella
  26: handbag
  27: tie
  28: suitcase
  29: frisbee
  30: skis
  31: snowboard
  32: sports ball
  33: kite
  34: baseball bat
  35: baseball glove
  36: skateboard
  37: surfboard
  38: tennis racket
  39: bottle
  40: wine glass
  41: cup
  42: fork
  43: knife
  44: spoon
  45: bowl
  46: banana
  47: apple
  48: sandwich
  49: orange
  50: broccoli
  51: carrot
  52: hot dog
  53: pizza
  54: donut
  55: cake
  56: chair
  57: couch
  58: potted plant
  59: bed
  60: dining table
  61: toilet
  62: tv
  63: laptop
  64: mouse
  65: remote
  66: keyboard
  67: cell phone
  68: microwave
  69: oven
  70: toaster
  71: sink
  72: refrigerator
  73: book
  74: clock
  75: vase
  76: scissors
  77: teddy bear
  78: hair drier
  79: toothbrush

# Download script/URL (optional)
download: https://github.com/ultralytics/assets/releases/download/v0.0.0/coco8.zip

Cada uno de train, val y test acepta un directorio, un archivo de imagen, una lista de directorios o archivos de imagen, o un archivo UTF-8 *.txt que enumere una ruta de imagen por línea (las rutas que empiecen por ./ se resuelven en relación con el archivo *.txt). Un archivo *.txt resulta útil para entrenar con un subconjunto de un directorio, omitir imágenes sin etiquetar o combinar imágenes de varios orígenes en una sola partición.

Rutas de imágenes en un archivo `*.txt`
path: datasets/coco8 # dataset root
train: train.txt # a directory, an image, a list e.g. [images/a, images/b], or a *.txt file
val: val.txt
names:
  0: person

(Opcional) colors asigna a cada clase un color de visualización como cadena entrecomillada "#rrggbb", indexada por ID de clase; por ejemplo, colors: ["#042aff", "#ff0000"]. Los modelos entrenados y exportados conservan estos colores para sus predicciones; las clases que no tienen uno usan la paleta predeterminada. Un registro de conjunto de datos NDJSON puede incluir el mismo campo colors.

Las etiquetas de este formato deben exportarse al formato YOLO, con un archivo *.txt por imagen. Si una imagen no contiene objetos, no es necesario crear ningún archivo *.txt. El archivo *.txt debe tener una fila por objeto en formato class x_center y_center width height. Las coordenadas del cuadro delimitador deben estar en formato xywh normalizado (de 0 a 1). Si tus cuadros están en píxeles, divide x_center y width por el ancho de la imagen, y y_center y height por su altura. Las coordenadas corresponden a la imagen tal como la muestran los visores, con la orientación EXIF aplicada, que es como Ultralytics lee todas las imágenes. Los índices de clase deben empezar en cero.

YOLO labeled image with bounding boxes on persons and tie

El archivo de etiquetas correspondiente a la imagen anterior contiene 2 personas (clase 0) y una corbata (clase 27):

YOLO format label file with normalized coordinates

Si usas el formato Ultralytics YOLO, organiza las imágenes y etiquetas de entrenamiento y validación como se muestra en el siguiente ejemplo del conjunto de datos COCO8.

YOLO dataset directory structure with train and val folders

Ejemplo de uso#

Así puedes usar conjuntos de datos en formato YOLO para entrenar tu modelo:

Ejemplo
from ultralytics import YOLO

# Cargar un modelo
model = YOLO("yolo26n.pt")  # Carga un modelo preentrenado (recomendado para el entrenamiento)

# Entrenar el modelo
results = model.train(data="coco8.yaml", epochs=100, imgsz=640)

Formato NDJSON de Ultralytics#

El formato JSON delimitado por líneas (NDJSON) ofrece una forma alternativa de definir conjuntos de datos para los modelos Ultralytics YOLO. Este formato almacena los metadatos y las anotaciones del conjunto de datos en un único archivo, donde cada línea contiene un objeto JSON independiente.

Un archivo de conjunto de datos NDJSON contiene:

  1. Registro del conjunto de datos (primera línea): contiene metadatos del conjunto de datos, como el tipo de tarea, los nombres de las clases e información general.
  2. Registros de imágenes (líneas siguientes): contienen los datos de cada imagen, como las dimensiones, las anotaciones y las rutas de archivo.
Ejemplo de NDJSON
{
    "type": "dataset",
    "task": "detect",
    "name": "Example",
    "description": "COCO NDJSON example dataset",
    "url": "https://platform.ultralytics.com/user/datasets/example",
    "class_names": { "0": "person", "1": "bicycle", "2": "car" },
    "bytes": 426342,
    "version": 0,
    "created_at": "2024-01-01T00:00:00Z",
    "updated_at": "2025-01-01T00:00:00Z"
}

Metadatos personalizados de imagen#

Cada registro de imagen puede incluir un objeto JSON metadata con información contextual específica de la aplicación, como las condiciones de captura, los identificadores del equipo o el estado de revisión. Se admiten valores anidados. Al importar los datos a Ultralytics Platform, los metadatos se guardan junto con la imagen y se pueden consultar o editar en su panel de información a pantalla completa.

{
    "type": "image",
    "file": "airbus-wing.jpg",
    "url": "https://example.com/airbus-wing.jpg",
    "split": "train",
    "metadata": {
        "aircraft": { "family": "A350", "section": "wing" },
        "inspectionStatus": "reviewed"
    }
}

Platform limita las claves de metadatos de nivel superior a 128 caracteres, el objeto de metadatos serializado de cada imagen a 500,000 caracteres y los metadatos efectivos combinados de una importación NDJSON a 500,000 caracteres.

Ejemplo de uso#

Para usar un conjunto de datos NDJSON con YOLO26, solo tienes que especificar la ruta al archivo .ndjson:

Ejemplo
from ultralytics import YOLO

# Cargar un modelo
model = YOLO("yolo26n.pt")

# Entrenar con un conjunto de datos NDJSON
results = model.train(data="path/to/dataset.ndjson", epochs=100, imgsz=640)

Ventajas del formato NDJSON#

  • Un único archivo: toda la información del conjunto de datos se encuentra en un solo archivo.
  • Procesamiento en streaming: permite procesar conjuntos de datos grandes línea por línea sin cargarlos por completo en memoria.
  • Integración con la nube: admite URL remotas de imágenes para entrenar en la nube.
  • Ampliable: es fácil añadir campos de metadatos personalizados.
  • Control de versiones: el formato de archivo único funciona bien con git y con los sistemas de control de versiones.

Conjuntos de datos compatibles#

Aquí tienes una lista de los conjuntos de datos compatibles y una breve descripción de cada uno. La mayoría también está alojada en Ultralytics Platform, donde puedes explorar las imágenes y las anotaciones, consultar estadísticas y clonarlos para entrenar en la nube.

  • African-wildlife: conjunto de datos con imágenes de fauna africana, como búfalos, elefantes, rinocerontes y cebras.
  • Argoverse: conjunto de datos Argoverse-HD de detección 2D, con 54,446 imágenes urbanas de conducción autónoma distribuidas en 8 clases de objetos viales.
  • Tumor cerebral: un conjunto de datos para detectar tumores cerebrales en imágenes de resonancia magnética cerebral, etiquetados con cajas delimitadoras de tumores en una sola clase.
  • COCO: Objetos comunes en contexto (COCO) es un conjunto de datos a gran escala para la detección y segmentación de objetos y la generación de descripciones, con 80 categorías de objetos.
  • COCO8: subconjunto reducido de las 8 primeras imágenes de COCO train2017, con 4 para entrenamiento y 4 para validación, adecuado para pruebas rápidas.
  • COCO8-Grayscale: versión en escala de grises de COCO8, creada al convertir RGB a escala de grises y útil para evaluar modelos de un solo canal.
  • COCO8-Multispectral: versión multiespectral de 10 canales de COCO8, creada mediante interpolación de las longitudes de onda RGB y útil para evaluar modelos con capacidad espectral.
  • COCO12-Formats: conjunto de prueba con 12 imágenes que abarca 12 formatos de imagen compatibles (AVIF, BMP, DNG, HEIC, JP2, JPEG, JPG, MPO, PNG, TIF, TIFF, WebP) para validar los procesos de carga de imágenes.
  • COCO16: subconjunto de las primeras 16 imágenes de COCO train2017 (8 de entrenamiento + 8 de validación), adecuado para pruebas rápidas.
  • COCO32: subconjunto de las primeras 32 imágenes de COCO train2017 (16 de entrenamiento + 16 de validación), adecuado para pruebas rápidas.
  • COCO64: subconjunto de las primeras 64 imágenes de COCO train2017 (32 de entrenamiento + 32 de validación), adecuado para pruebas rápidas.
  • COCO128: subconjunto reducido de las 128 primeras imágenes de COCO train2017, adecuado para pruebas.
  • Construction-PPE: conjunto de datos con trabajadores de obras de construcción y equipos de seguridad etiquetados, como cascos, chalecos, guantes, botas y gafas protectoras. También incluye anotaciones sobre equipos ausentes, como no_helmet y no_goggle, para supervisar el cumplimiento en entornos reales.
  • Global Wheat 2020: conjunto de datos con imágenes de espigas de trigo para el Global Wheat Challenge 2020.
  • HomeObjects-3K: conjunto de datos de objetos domésticos, como camas, sillas y televisores, ideal para aplicaciones de domótica, robótica, realidad aumentada y análisis de la distribución de habitaciones.
  • KITTI: conjunto de datos con escenas de conducción reales y datos estéreo, LiDAR y GPS/IMU, utilizado aquí para tareas de detección de objetos 2D, como identificar coches, peatones y ciclistas en entornos urbanos, rurales y de autopista.
  • LVIS: conjunto de datos a gran escala para la detección de objetos y la segmentación de instancias, con 1.203 categorías de objetos.
  • Medical-pills: conjunto de datos con imágenes de comprimidos, anotadas para aplicaciones como el control de calidad farmacéutico, la clasificación de comprimidos y el cumplimiento normativo.
  • Objects365: conjunto de datos de alta calidad y a gran escala para la detección de objetos, con 365 categorías de objetos y más de 1.7M de imágenes de entrenamiento.
  • OpenImagesV7: completo conjunto de datos de Google con 1,7 millones de imágenes de entrenamiento y 42.000 imágenes de validación.
  • Roboflow 100: un banco de pruebas diverso de detección de objetos con 100 conjuntos de datos que abarcan siete dominios de imágenes para una evaluación exhaustiva de modelos.
  • Signature: conjunto de datos con imágenes de varios documentos y firmas anotadas, que facilita la investigación sobre verificación documental y detección de fraude.
  • SKU-110K: conjunto de datos de detección densa de objetos en entornos comerciales, con más de 11.000 imágenes y 1,7 millones de cajas delimitadoras.
  • TT100K: conjunto de datos de señales de tráfico Tsinghua-Tencent 100K (TT100K), con 16 817 imágenes de vistas de calles distribuidas en 221 categorías de señales para tareas de detección y clasificación.
  • Ultralytics Benchmark: conjunto de pruebas de referencia propio con 37 conjuntos de datos de detección seleccionados de los ámbitos médico, aéreo, industrial, minorista y otros, y un protocolo fijo para medir la capacidad de generalización de los modelos en el mundo real.
  • VisDrone: conjunto de datos de detección de objetos y seguimiento de múltiples objetos en imágenes capturadas con drones, con más de 10.000 imágenes y secuencias de vídeo.
  • VOC: el conjunto de datos de clases de objetos visuales Pascal (VOC) para la detección y segmentación de objetos, con 20 clases de objetos y más de 11 000 imágenes.
  • xView: conjunto de datos para la detección de objetos en imágenes aéreas, con 60 categorías de objetos y más de un millón de objetos anotados.

Añadir tu propio conjunto de datos#

Si tienes tu propio conjunto de datos y quieres utilizarlo para entrenar modelos de detección con el formato Ultralytics YOLO, asegúrate de que sigue el formato especificado anteriormente en «Formato Ultralytics YOLO». Convierte tus anotaciones al formato requerido y especifica las rutas, el número de clases y los nombres de las clases en el archivo de configuración YAML.

Adaptar o convertir formatos de etiquetas#

Convertir el formato del conjunto de datos COCO al formato YOLO#

Puedes convertir las etiquetas del formato del popular conjunto de datos COCO al formato YOLO con el siguiente fragmento de código:

Ejemplo
from ultralytics.data.converter import convert_coco

convert_coco(labels_dir="path/to/coco/annotations/")

Esta herramienta de conversión se puede utilizar para convertir el conjunto de datos COCO o cualquier conjunto de datos en formato COCO al formato Ultralytics YOLO. El proceso transforma las anotaciones COCO basadas en JSON al formato YOLO más sencillo, basado en texto, para que sean compatibles con los modelos Ultralytics YOLO. Consulta Convertir anotaciones COCO a YOLO para ver el flujo de trabajo completo, incluida la asignación de ID de clase, la estructura de directorios y las anotaciones de segmentación o pose.

Recuerda comprobar que el conjunto de datos que quieres utilizar es compatible con tu modelo y sigue las convenciones de formato necesarias. Los conjuntos de datos con el formato adecuado son esenciales para entrenar modelos de detección de objetos eficaces.

Qué hacer a continuación#

Con el conjunto de datos ya preparado, empieza a entrenar tu modelo. ¿No sabes con qué modelo preentrenado empezar? Compara las opciones de la familia de modelos YOLO26.

Preguntas frecuentes#

  • El formato Ultralytics YOLO es una configuración estructurada para definir conjuntos de datos en tus proyectos de entrenamiento. Consiste en establecer las rutas a las imágenes de entrenamiento, validación y prueba, así como a sus etiquetas correspondientes. Por ejemplo:

    # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
    
    # COCO8 dataset (first 8 images from COCO train2017) by Ultralytics
    # Documentation: https://docs.ultralytics.com/datasets/detect/coco8
    # Example usage: yolo train data=coco8.yaml
    # parent
    # ├── ultralytics
    # └── datasets
    #     └── coco8 ← downloads here (1 MB)
    
    # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
    path: coco8 # dataset root dir
    train: images/train # train images (relative to 'path') 4 images
    val: images/val # val images (relative to 'path') 4 images
    test: # test images (optional)
    
    # Classes
    names:
      0: person
      1: bicycle
      2: car
      3: motorcycle
      4: airplane
      5: bus
      6: train
      7: truck
      8: boat
      9: traffic light
      10: fire hydrant
      11: stop sign
      12: parking meter
      13: bench
      14: bird
      15: cat
      16: dog
      17: horse
      18: sheep
      19: cow
      20: elephant
      21: bear
      22: zebra
      23: giraffe
      24: backpack
      25: umbrella
      26: handbag
      27: tie
      28: suitcase
      29: frisbee
      30: skis
      31: snowboard
      32: sports ball
      33: kite
      34: baseball bat
      35: baseball glove
      36: skateboard
      37: surfboard
      38: tennis racket
      39: bottle
      40: wine glass
      41: cup
      42: fork
      43: knife
      44: spoon
      45: bowl
      46: banana
      47: apple
      48: sandwich
      49: orange
      50: broccoli
      51: carrot
      52: hot dog
      53: pizza
      54: donut
      55: cake
      56: chair
      57: couch
      58: potted plant
      59: bed
      60: dining table
      61: toilet
      62: tv
      63: laptop
      64: mouse
      65: remote
      66: keyboard
      67: cell phone
      68: microwave
      69: oven
      70: toaster
      71: sink
      72: refrigerator
      73: book
      74: clock
      75: vase
      76: scissors
      77: teddy bear
      78: hair drier
      79: toothbrush
    
    # Download script/URL (optional)
    download: https://github.com/ultralytics/assets/releases/download/v0.0.0/coco8.zip

    Las etiquetas se guardan en archivos *.txt, con un archivo por imagen, en el formato class x_center y_center width height y con coordenadas normalizadas. Consulta el ejemplo del conjunto de datos COCO8 para ver una guía detallada.

  • Puedes convertir un conjunto de datos COCO al formato YOLO con las herramientas de conversión de Ultralytics. Aquí tienes un método rápido:

    from ultralytics.data.converter import convert_coco
    
    convert_coco(labels_dir="path/to/coco/annotations/")

    Este código convierte tus anotaciones COCO al formato YOLO para que puedas entrenar modelos Ultralytics YOLO con ellas.

  • Ultralytics YOLO admite una amplia variedad de conjuntos de datos, entre ellos:

    Cada página de conjunto de datos ofrece información detallada sobre su estructura y uso, adaptada para entrenar YOLO26 de forma eficiente. Consulta la lista completa en la sección Conjuntos de datos admitidos.

  • Para empezar a entrenar un modelo YOLO26, asegúrate de que tu conjunto de datos tiene el formato correcto y de que las rutas están definidas en un archivo YAML. Utiliza el siguiente script para empezar a entrenar:

    Ejemplo
    from ultralytics import YOLO
    
    model = YOLO("yolo26n.pt")  # Cargar un modelo preentrenado
    results = model.train(data="path/to/your_dataset.yaml", epochs=100, imgsz=640)
  • Ultralytics ofrece numerosos ejemplos y guías prácticas para usar YOLO en diversas aplicaciones. Visita el blog de Ultralytics para consultar casos prácticos, tutoriales detallados e historias de la comunidad sobre detección de objetos, segmentación y mucho más. Para ver ejemplos concretos, consulta la página del modo de predicción en la documentación.

Comentarios54

Haz una pregunta, comparte tus resultados o ayuda a otra persona.

    1. Paula DerrengerUltralytics

      @zcoolster11, could you clarify what you mean by “Python Head Bop” and what you’d like to do with Ultralytics YOLO? Feel free to drop your dataset or Python questions here in the discussion so the Ultralytics team can help.

  1. Murat Raimbekov

    hey @orz-serein, short answer: no, you don't need empty label files for background images - just leave the .txt out.

    i verified this empirically on the current main branch. setup: 5 images, 2 with real labels, 1 with an empty .txt file, 2 without any .txt file at all. building a YOLODataset over them gives:

    Scanning /tmp/bgtest_full/labels... 3 images, 3 backgrounds, 0 corrupt: 100% 5/5

    all 5 images are kept. the 3 without labels (the empty-.txt one and the two with no .txt at all) all end up with the same (0, 5) labels array - they are treated identically as background images.

    so both options work:

    • no .txt file: counted as "missing" (nm=1), no labels -> background
    • empty .txt file: counted as "empty" (ne=1), no labels -> background

    both end up in the same backgrounds = nm + ne bucket in ultralytics/data/dataset.py.

    this is also stated in the detection dataset docs:

    If there are no objects in an image, no *.txt file is required.

    how many background images: the yolov5 training tips recommend 0-10% of the dataset as background images to reduce false positives (coco has about 1% background).

    hope this helps!

  2. serein

    Hello, I would like to ask a question. During the stage of preparing the training dataset, if some images do not have the target to be detected, do I need to add corresponding empty label files in the label folder?

  3. Fatima-khanjarGitHub

    Hello, I hope this message finds you well.

    I have a question regarding fine-tuning a pre-trained YOLO model (e.g., trained on the COCO dataset) on my custom dataset. My dataset includes both new classes (not present in COCO) and the same existing classes (e.g., toothbrush, car), but with different layouts. Specifically, I would like to add my new classes starting from index 80, while still leveraging the pre-trained weights for the common classes, which are the same but with different layouts.

    Is it possible to use the pre-trained weights for the common classes and only train the model on the new classes, while ensuring that the pre-trained knowledge for the common classes is preserved? If so, could you please guide me on how to proceed?

    Thank you for your time and assistance. best regards,

  4. bimal-gajeraGitHub

    Hello, I'm working on multiple dataset formats for object detection. For the YOLO dataset format, is there any way I can rename the labels directory and put it in yaml file? Something like this:

    path: path_to_root_directory
    train: train\images
    val: val\images
    test: test\images
    
    labels_dir: yolo
    
    nc: 1
    names: ['object']

    yolo directory has yolo annotations (*.txt files), and it's inside respective train, val and test directory.

    1. Glenn JocherUltralytics(editado)

      @bimal-gajera currently, the labels_dir key is not supported in the YAML file. Ultralytics finds label files by replacing the last /images/ directory in each image path with /labels/, so each split needs sibling images/ and labels/ directories (for example train/images and train/labels). For more details, refer to the Object Detection Datasets Overview.

      1
  5. nitya-pandey-astroGitHub

    Hello Team, I am using YOLO for detecting trails of slow-moving astronomical objects in my images. While the model detects the trails, the bounding boxes predicted around the objects are not tight enough. The boxes tend to be too loose or not well-shaped to fit the elongated, irregular trails, resulting in inaccurate object localization. I suspect, YOLO's standard rectangular bounding box not being well-suited for the elongated, curving shapes of the trails. Could you provide guidance on how to improve bounding box accuracy for this specific use case?

    1. Glenn JocherUltralytics(editado)

      @astronitya thank you for your question! For detecting elongated or irregular trails, consider using Oriented Bounding Boxes (OBB), which may better fit your objects' shapes compared to standard rectangular boxes. You can format your dataset in the YOLO OBB format and train a YOLO26 OBB model. Please refer to the Oriented Bounding Box (OBB) Datasets Overview for details on dataset formatting and training. Let me know if you need further clarification!

  6. Yuxuan1998GitHub

    Hi team, I am a little bit confused with the dataset folder structure. For most dataset I used, it strunctured in the way that each of train/ and val/ folders contains images/ and labels/ folders. However, the COCO8 dataset example shows the opposite way, each of images/ and labels/ folder contains test/ and val/ folders. Does the folder structure matter here? Thanks in advance

    1. Glenn JocherUltralytics(editado)

      @Yuxuan1998 both layouts work, as long as each image has a sibling labels directory: Ultralytics finds the label for an image by replacing the last /images/ in its path with /labels/ (so train/images/img.jpg uses train/labels/img.txt, and images/train/img.jpg uses labels/train/img.txt). Set the paths in your dataset's YAML file to the image directories. For details, refer to the Object Detection Datasets Overview. Let us know if you need further clarification!

      1
  7. milanaveedGitHub

    Hello, can you please fix the broken images on this page? Can't see the label file example.

  8. wgdcxyGitHub

    Hello, my label and image files are stored according to the requirements, but they are still not recognized, and the following is an error message Thank you in advance

    WARNING ⚠️ imgsz=[2448] must be multiple of max stride 32, updating to [2464] train: Scanning D:\Textile_testing\ultralytics-seg\cs\labels\ttb... 0 images, 30 backgrounds, 0 corrupt: 100%|██████████| 30/30 [00:00<00:00, 1138.41it/s] train: WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttb.cache. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. train: WARNING ⚠️ Cache directory D:\Textile_testing\ultralytics-seg\cs\labels is not writeable, cache not saved. WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttb.cache, training may not work correctly. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. val: Scanning D:\Textile_testing\ultralytics-seg\cs\labels\ttj... 0 images, 30 backgrounds, 0 corrupt: 100%|██████████| 30/30 [00:00<00:00, 1617.94it/s] val: WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttj.cache. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. val: WARNING ⚠️ Cache directory D:\Textile_testing\ultralytics-seg\cs\labels is not writeable, cache not saved. WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttj.cache, training may not work correctly. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. Plotting labels to runs\segment\train3\labels.jpg...

    1. wgdcxyGitHub

      Hi, but my file path is very accurate, and I checked it N times, so is there any otherreason? Thank you

    2. Glenn JocherUltralytics

      @wgdcxy please ensure your label files are in the correct YOLO format, with one .txt file per image containing normalized coordinates. Also, verify that the directory permissions allow writing. For more details, refer to the dataset formatting guide linked earlier.

    3. wgdcxyGitHub

      Hello, I'm a student whose English is not particularly good, so some places may not be clear, and secondly, this is not an error but a warning.I don't know why it's the background that reads, not the images. The warnings are as follows: val: Scanning D:\Textile_testing\ultralytics-seg\cs\labels\ttj... 0 images, 30 backgrounds, 0 corrupt: 100%| 30/30 [00:00<00:00, 495.76it/s] val: WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttj.cache. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. val: WARNING ⚠️ Cache directory D:\Textile_testing\ultralytics-seg\cs\labels is not writeable, cache not saved. WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttj.cache, training may not work correctly. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. Plotting labels to runs\segment\train4\labels.jpg...

      Then this warning tells me that the cache file is missing, and I don't know why I can't generate a cache file for the file I created, so I'm here to ask you guys. Below is my own yaml file: # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..] path: ../cs # dataset root dir train: images/ttb # train images (relative to 'path') 128 images val: images/ttj # val images (relative to 'path') 128 images test: # test images (optional) # Classes names : 0 : wf

      Below is my label file: 0 0.6799428104575164 0.5005859375 0.6844771241830065 0.500537109375 0.6845996732026144 0.497265625 0.6802696078431373 0.497119140625 0 0.6803104575163399 0.4935546875 0.6848039215686275 0.493505859375 0.6847630718954248 0.497119140625 0.6802696078431373 0.49697265625 0 0.6802696078431373 0.49013671875 0.6849673202614379 0.490185546875 0.6849264705882353 0.49345703125 0.6803513071895425 0.493359375 0 0.6805555555555556 0.48662109375 0.6850898692810458 0.486767578125 0.6850490196078431 0.490234375 0.6803513071895425 0.490234375 0 0.6808415032679739 0.483447265625 0.6852941176470588 0.48349609375 0.6852124183006536 0.486767578125 0.6806781045751634 0.486669921875 0 0.6806372549019607 0.47998046875 0.6854166666666666 0.47998046875 0.6853349673202613 0.48349609375 0.6808415032679738 0.48359375

      Finally, this yolo can be run, but I don't know why the result is 0. Here's how it works: Transferred 381/417 items from pretrained weights 195/200 8.73G 0 0 nan 0 0 2464: 100%|██████████| 8/8 [01:37<00:00, 12.13s/it] Class Images Instances Box(P R mAP50 mAP50-95) Mask(P R mAP50 mAP50-95): 100%|[00:31<00:00, 7.91s/it] all 30 0 0 0 0 0 0 0 0 0 Finally, thank you for explaining it to me

    4. wgdcxyGitHub

      By the way, the size of my picture is 2448x2048, so the imgsz entered is 2448, and your code changed the size of my picture to 2464, is it related to this. imgsz=[2448] must be multiple of max stride 32, updating to [2464]

    5. wgdcxyGitHub

      I apologize, I found a small mistake of mine. I wrote the file name as "labels" instead of "lables" which I intended to write.Please forgive my carelessness.After all, who doesn't make mistakes. I'll come back to you next time I have a problem. Thank you for your help.

    6. wgdcxyGitHub

      Transferred 417/417 items from pretrained weights Freezing layer 'model.22.dfl.conv.weight' AMP: running Automatic Mixed Precision (AMP) checks with YOLOv8n... AMP: checks passed ✅ WARNING ⚠️ imgsz=[2448] must be multiple of max stride 32, updating to [2464] train: Scanning D:\Textile_testing\ultralytics-seg\cs\labels\ttb.cache... 30 images, 0 backgrounds, 0 corrupt: 100%|██████████| 30/30 [00:00<?, ?it/s] Hello, here I am again, with a new problem, how to solve this problem about image size?Ask for answers, thank you

    7. Glenn JocherUltralytics

      @wgdcxy to address the image size issue, ensure your imgsz is a multiple of 32, as required by the model's architecture. This adjustment helps maintain compatibility with the model's stride. If you have further questions, feel free to ask!

    8. wgdcxyGitHub

      WARNING ⚠️ NMS time limit 0.900s exceeded. Hello, my teacher who has never met, what should I do with this warning?

    9. Glenn JocherUltralytics(editado)

      @wgdcxy the "NMS time limit exceeded" warning is not controlled by an nms argument. It appears when too many candidate boxes need to be processed within the time limit, which is common early in training when validation uses a low confidence threshold. It usually stops as the model trains, and you can reduce it by raising conf or lowering max_det during validation. If you have further questions, feel free to ask!

    10. wgdcxyGitHub

      Hello, I'm here again. The issue this time is still the same warning. I adjusted the max_time_img to 0.1 in ops. py, but I don't feel it's right. So I came to ask for your help because it still shows this warning. I hope you can tell me where to make the adjustment. Thank you again. WARNING ⚠️ NMS time limit 0.900s exceeded

    11. wgdcxyGitHub

      How can these values be improved? We can only continue training or increase the training dataset. Epoch GPU_mem box_loss seg_loss cls_loss dfl_loss Instances Size 11/500 11G nan 6.21 nan nan 132 2464: 100%|██████████| 8/8 [01:56<00:00, 14.59s/it] Class Images Instances Box(P R mAP50 mAP50-95) Mask(P R mAP50 mAP50-95): 100%|██████████| 4/4 [00:54<00:00, 13.56s/it] all 30 664 0 0 0 0 0 0 0 0

    12. Glenn JocherUltralytics

      To improve your model's performance, consider increasing the dataset size, enhancing data quality, or adjusting hyperparameters. If issues persist, reviewing the dataset for label accuracy and distribution might help.

  9. wgdcxyGitHub

    WARNING ⚠️ imgsz=[2448] must be multiple of max stride 32, updating to [2464] train: Scanning D:\Textile_testing\ultralytics-seg\cs\labels\ttb... 0 images, 30 backgrounds, 0 corrupt: 100%|██████████| 30/30 [00:00<00:00, 1138.41it/s] train: WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttb.cache. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. train: WARNING ⚠️ Cache directory D:\Textile_testing\ultralytics-seg\cs\labels is not writeable, cache not saved. WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttb.cache, training may not work correctly. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. val: Scanning D:\Textile_testing\ultralytics-seg\cs\labels\ttj... 0 images, 30 backgrounds, 0 corrupt: 100%|██████████| 30/30 [00:00<00:00, 1617.94it/s] val: WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttj.cache. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. val: WARNING ⚠️ Cache directory D:\Textile_testing\ultralytics-seg\cs\labels is not writeable, cache not saved. WARNING ⚠️ No labels found in D:\Textile_testing\ultralytics-seg\cs\labels\ttj.cache, training may not work correctly. See https://docs.ultralytics.com/datasets/detect for dataset formatting guidance. Plotting labels to runs\segment\train3\labels.jpg...

    这个问题该如何解决?