├── CLIP ├── .gitignore ├── CLIP.png ├── LICENSE ├── MANIFEST.in ├── README.md ├── clip │ ├── __init__.py │ ├── bpe_simple_vocab_16e6.txt.gz │ ├── clip.py │ ├── model.py │ └── simple_tokenizer.py ├── data │ ├── country211.md │ ├── prompts.md │ ├── rendered-sst2.md │ └── yfcc100m.md ├── doc │ ├── learn.md │ └── learn.py ├── hubconf.py ├── model-card.md ├── notebooks │ ├── Interacting_with_CLIP.ipynb │ └── Prompt_Engineering_for_ImageNet.ipynb ├── predict.py ├── push.py ├── tar.sh └── tests │ └── test_consistency.py ├── LICENSE ├── README.md ├── demo ├── alss_yolo.py ├── sam2_video_demo.py └── yolov8.py ├── docs ├── ALSS-YOLO-seg.md ├── ALSS-YOLO.md ├── CITATION.cff ├── Datasets.md ├── Display.md ├── IOU.md ├── Metrics.md └── 迭代优化的标注工作流.PNG ├── examples ├── README.md ├── YOLOv8-Action-Recognition │ ├── action_recognition.py │ └── readme.md ├── YOLOv8-CPP-Inference │ ├── CMakeLists.txt │ ├── README.md │ ├── inference.cpp │ ├── inference.h │ └── main.cpp ├── YOLOv8-LibTorch-CPP-Inference │ ├── CMakeLists.txt │ ├── README.md │ └── main.cc ├── YOLOv8-ONNXRuntime-CPP │ ├── CMakeLists.txt │ ├── README.md │ ├── inference.cpp │ ├── inference.h │ └── main.cpp ├── YOLOv8-ONNXRuntime-Rust │ ├── Cargo.toml │ ├── README.md │ └── src │ │ ├── cli.rs │ │ ├── lib.rs │ │ ├── main.rs │ │ ├── model.rs │ │ ├── ort_backend.rs │ │ └── yolo_result.rs ├── YOLOv8-ONNXRuntime │ ├── README.md │ └── main.py ├── YOLOv8-OpenCV-ONNX-Python │ ├── README.md │ └── main.py ├── YOLOv8-OpenCV-int8-tflite-Python │ ├── README.md │ └── main.py ├── YOLOv8-OpenVINO-CPP-Inference │ ├── CMakeLists.txt │ ├── README.md │ ├── inference.cc │ ├── inference.h │ └── main.cc ├── YOLOv8-Region-Counter │ ├── readme.md │ └── yolov8_region_counter.py ├── YOLOv8-SAHI-Inference-Video │ ├── readme.md │ └── yolov8_sahi.py ├── YOLOv8-Segmentation-ONNXRuntime-Python │ ├── README.md │ └── main.py ├── heatmaps.ipynb ├── hub.ipynb ├── object_counting.ipynb ├── object_tracking.ipynb └── tutorial.ipynb ├── push.py ├── pyproject.toml ├── scripts ├── Gradio-YOLO │ ├── .gitattributes │ ├── .gitignore │ ├── README.md │ ├── __init__.py │ ├── app.py │ ├── appv1.py │ ├── gyd_style.css │ ├── img_examples │ │ ├── 0000000349_0000000000_0000000489.jpg │ │ ├── 0000000353_0000000000_0000000652.jpg │ │ ├── 20241217-095819.jpg │ │ ├── DJI_20240323110116_0053_D.jpg │ │ ├── DJI_20240323112100_0019_D.jpg │ │ ├── DJI_20240323135316_0031_D.jpg │ │ ├── DJI_20240323174441_0222_D.jpg │ │ ├── ILSVRC2012_val_00000008.JPEG │ │ ├── ILSVRC2012_val_00000018.JPEG │ │ ├── ILSVRC2012_val_00000023.JPEG │ │ ├── ILSVRC2012_val_00000067.JPEG │ │ ├── ILSVRC2012_val_00000077.JPEG │ │ ├── bus.jpg │ │ └── zidane.jpg │ ├── requirements.txt │ ├── util.py │ └── util │ │ ├── fonts_opt.py │ │ └── pdf_opt.py ├── bug_test.py ├── plot │ ├── heatmap.py │ ├── map_pr_f1_curve.py │ ├── 分割画图.py │ └── 检测画图.py ├── predict │ ├── predict.py │ ├── predict_v2.py │ ├── preditct_config.py │ └── track.py ├── train │ ├── train1.py │ ├── train2.py │ ├── train3.py │ ├── train4.py │ ├── train5.py │ ├── train6.py │ ├── train7.py │ ├── train8.py │ └── train_config.py ├── utile │ ├── 0_box_point_SAM.py │ ├── 10_IoU.py │ ├── 10_mIoU.py │ ├── 10_mIoUv2.py │ ├── 11_yolo2labels.py │ ├── 12_yolo2seglabels.py │ ├── 13_边框尺度缩放.py │ ├── 14_自带数据转换.py │ ├── 1_pix.py │ ├── 2_load_model.py │ ├── 3_computer_miou.py │ ├── 4_generate_segmentation_labels.py │ ├── 5_yolo_sam_auto_annotate.py │ ├── 8_MBB.py │ ├── 9_coco2yolo_seg.py │ ├── free_cuda.py │ ├── get_FPS.py │ ├── main_profile.py │ ├── mota.py │ ├── send_notice.py │ ├── xml2txt.py │ ├── 文件行数.py │ ├── 测试cuda是否可用.py │ └── 转换.py └── val │ ├── val.py │ └── val_config.py ├── tar.sh ├── train.sh ├── ultralytics.egg-info ├── PKG-INFO ├── SOURCES.txt ├── dependency_links.txt ├── entry_points.txt ├── requires.txt └── top_level.txt └── ultralytics ├── __init__.py ├── __pycache__ └── __init__.cpython-310.pyc ├── assets ├── bus.jpg └── zidane.jpg ├── cfg_yaml ├── __init__.py ├── __pycache__ │ └── __init__.cpython-310.pyc ├── datasets │ ├── Argoverse.yaml │ ├── DOTAv1.5.yaml │ ├── DOTAv1.yaml │ ├── GlobalWheat2020.yaml │ ├── ImageNet.yaml │ ├── Objects365.yaml │ ├── SKU-110K.yaml │ ├── VOC.yaml │ ├── VisDrone.yaml │ ├── african-wildlife.yaml │ ├── brain-tumor.yaml │ ├── carparts-seg.yaml │ ├── coco-pose.yaml │ ├── coco.yaml │ ├── coco128-seg.yaml │ ├── coco128.yaml │ ├── coco8-pose.yaml │ ├── coco8-seg.yaml │ ├── coco8.yaml │ ├── crack-seg.yaml │ ├── dog-pose.yaml │ ├── dota8.yaml │ ├── hand-keypoints.yaml │ ├── lvis.yaml │ ├── medical-pills.yaml │ ├── open-images-v7.yaml │ ├── package-seg.yaml │ ├── signature.yaml │ ├── tiger-pose.yaml │ └── xView.yaml ├── default.yaml ├── models │ ├── 11 │ │ ├── yolo11-cls.yaml │ │ ├── yolo11-obb.yaml │ │ ├── yolo11-pose.yaml │ │ ├── yolo11-seg.yaml │ │ └── yolov11.yaml │ ├── ALSS-YOLO-seg │ │ └── ALSS-YOLO-seg.yaml │ ├── ALSS-YOLO-world │ │ └── ALSS-YOLO-world.yaml │ ├── ALSS-YOLO │ │ ├── ALSSm-seg.yaml │ │ ├── ALSSm.yaml │ │ ├── ALSSn-seg.yaml │ │ ├── ALSSn.yaml │ │ ├── ALSSs-seg.yaml │ │ ├── ALSSs.yaml │ │ └── add_contrast_experiment │ │ │ ├── ALSSm-CA.yaml │ │ │ ├── ALSSm.yaml │ │ │ ├── ALSSn-CA.yaml │ │ │ ├── ALSSn-LCA_18.yaml │ │ │ ├── ALSSn-LCA_22.yaml │ │ │ ├── ALSSn-LCA_8.yaml │ │ │ ├── ALSSn.yaml │ │ │ ├── ALSSs-CA.yaml │ │ │ ├── yolov8-AM.yaml │ │ │ ├── yolov8-ghost.yaml │ │ │ ├── yolov8-p2.yaml │ │ │ └── yolov8.yaml │ ├── README.md │ ├── rt-detr │ │ ├── rtdetr-l.yaml │ │ ├── rtdetr-resnet101.yaml │ │ ├── rtdetr-resnet50.yaml │ │ └── rtdetr-x.yaml │ ├── v10 │ │ ├── yolov10_test.yaml │ │ ├── yolov10b.yaml │ │ ├── yolov10l.yaml │ │ ├── yolov10m.yaml │ │ ├── yolov10n-seg.yaml │ │ ├── yolov10n.yaml │ │ ├── yolov10s.yaml │ │ └── yolov10x.yaml │ ├── v3 │ │ ├── yolov3-spp.yaml │ │ ├── yolov3-tiny.yaml │ │ └── yolov3.yaml │ ├── v5 │ │ ├── yolov5-p6.yaml │ │ └── yolov5.yaml │ ├── v6 │ │ └── yolov6.yaml │ ├── v8 │ │ ├── yolov8-cls-resnet101.yaml │ │ ├── yolov8-cls-resnet50.yaml │ │ ├── yolov8-cls.yaml │ │ ├── yolov8-ghost-p2.yaml │ │ ├── yolov8-ghost-p6.yaml │ │ ├── yolov8-ghost.yaml │ │ ├── yolov8-obb.yaml │ │ ├── yolov8-p2.yaml │ │ ├── yolov8-p6.yaml │ │ ├── yolov8-pose-p6.yaml │ │ ├── yolov8-pose.yaml │ │ ├── yolov8-rtdetr.yaml │ │ ├── yolov8-seg-p6.yaml │ │ ├── yolov8-seg.yaml │ │ ├── yolov8-world.yaml │ │ ├── yolov8-worldv2.yaml │ │ └── yolov8.yaml │ └── v9 │ │ ├── yolov9c-seg.yaml │ │ ├── yolov9c.yaml │ │ ├── yolov9e-seg.yaml │ │ ├── yolov9e.yaml │ │ ├── yolov9m.yaml │ │ ├── yolov9s.yaml │ │ └── yolov9t.yaml ├── test.py └── trackers │ ├── botsort.yaml │ └── bytetrack.yaml ├── data ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-310.pyc │ ├── augment.cpython-310.pyc │ ├── base.cpython-310.pyc │ ├── build.cpython-310.pyc │ ├── converter.cpython-310.pyc │ ├── dataset.cpython-310.pyc │ ├── loaders.cpython-310.pyc │ └── utils.cpython-310.pyc ├── annotator.py ├── augment.py ├── base.py ├── build.py ├── converter.py ├── dataset.py ├── explorer │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-310.pyc │ │ ├── explorer.cpython-310.pyc │ │ └── utils.cpython-310.pyc │ ├── explorer.py │ ├── gui │ │ ├── __init__.py │ │ └── dash.py │ └── utils.py ├── loaders.py ├── scripts │ ├── download_weights.sh │ ├── get_coco.sh │ ├── get_coco128.sh │ └── get_imagenet.sh ├── split_dota.py └── utils.py ├── engine ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-310.pyc │ ├── exporter.cpython-310.pyc │ ├── predictor.cpython-310.pyc │ ├── project.cpython-310.pyc │ ├── results.cpython-310.pyc │ ├── trainer.cpython-310.pyc │ └── validator.cpython-310.pyc ├── exporter.py ├── predictor.py ├── project.py ├── results.py ├── trainer.py ├── tuner.py └── validator.py ├── hub ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-310.pyc │ ├── auth.cpython-310.pyc │ ├── session.cpython-310.pyc │ └── utils.cpython-310.pyc ├── auth.py ├── session.py └── utils.py ├── models ├── __init__.py ├── __pycache__ │ └── __init__.cpython-310.pyc ├── fastsam │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-310.pyc │ │ ├── model.cpython-310.pyc │ │ ├── predict.cpython-310.pyc │ │ ├── utils.cpython-310.pyc │ │ └── val.cpython-310.pyc │ ├── model.py │ ├── predict.py │ ├── utils.py │ └── val.py ├── nas │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-310.pyc │ │ ├── model.cpython-310.pyc │ │ ├── predict.cpython-310.pyc │ │ └── val.cpython-310.pyc │ ├── model.py │ ├── predict.py │ └── val.py ├── rtdetr │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-310.pyc │ │ ├── model.cpython-310.pyc │ │ ├── predict.cpython-310.pyc │ │ ├── train.cpython-310.pyc │ │ └── val.cpython-310.pyc │ ├── model.py │ ├── predict.py │ ├── train.py │ └── val.py ├── sam │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-310.pyc │ │ ├── amg.cpython-310.pyc │ │ ├── build.cpython-310.pyc │ │ ├── model.cpython-310.pyc │ │ └── predict.cpython-310.pyc │ ├── amg.py │ ├── build.py │ ├── model.py │ ├── modules │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-310.pyc │ │ │ ├── blocks.cpython-310.pyc │ │ │ ├── decoders.cpython-310.pyc │ │ │ ├── encoders.cpython-310.pyc │ │ │ ├── memory_attention.cpython-310.pyc │ │ │ ├── sam.cpython-310.pyc │ │ │ ├── tiny_encoder.cpython-310.pyc │ │ │ ├── transformer.cpython-310.pyc │ │ │ └── utils.cpython-310.pyc │ │ ├── blocks.py │ │ ├── decoders.py │ │ ├── encoders.py │ │ ├── memory_attention.py │ │ ├── sam.py │ │ ├── tiny_encoder.py │ │ ├── transformer.py │ │ └── utils.py │ └── predict.py ├── utils │ ├── __init__.py │ ├── loss.py │ └── ops.py └── yolo │ ├── __init__.py │ ├── __pycache__ │ ├── __init__.cpython-310.pyc │ └── projects.cpython-310.pyc │ ├── classify │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-310.pyc │ │ ├── predict.cpython-310.pyc │ │ ├── train.cpython-310.pyc │ │ └── val.cpython-310.pyc │ ├── predict.py │ ├── train.py │ └── val.py │ ├── detect │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-310.pyc │ │ ├── predict.cpython-310.pyc │ │ ├── train.cpython-310.pyc │ │ └── val.cpython-310.pyc │ ├── predict.py │ ├── train.py │ └── val.py │ ├── learn.txt │ ├── obb │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-310.pyc │ │ ├── predict.cpython-310.pyc │ │ ├── train.cpython-310.pyc │ │ └── val.cpython-310.pyc │ ├── predict.py │ ├── train.py │ └── val.py │ ├── pose │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-310.pyc │ │ ├── predict.cpython-310.pyc │ │ ├── train.cpython-310.pyc │ │ └── val.cpython-310.pyc │ ├── predict.py │ ├── train.py │ └── val.py │ ├── projects.py │ ├── segment │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-310.pyc │ │ ├── predict.cpython-310.pyc │ │ ├── train.cpython-310.pyc │ │ └── val.cpython-310.pyc │ ├── predict.py │ ├── train.py │ └── val.py │ └── world │ ├── __init__.py │ ├── __pycache__ │ ├── __init__.cpython-310.pyc │ └── train.cpython-310.pyc │ ├── train.py │ └── train_world.py ├── nn ├── __pycache__ │ ├── autobackend.cpython-310.pyc │ └── tasks.cpython-310.pyc ├── autobackend.py ├── extra_modules │ ├── ALSS2_YOLO.py │ ├── ALSS_YOLO.py │ ├── CE_RetinaNet.py │ ├── YOLOv8_AM.py │ ├── __init__.py │ ├── __pycache__ │ │ ├── ALSS2_YOLO.cpython-310.pyc │ │ ├── ALSS_YOLO.cpython-310.pyc │ │ ├── CE_RetinaNet.cpython-310.pyc │ │ ├── YOLOv8_AM.cpython-310.pyc │ │ └── __init__.cpython-310.pyc │ └── block.py ├── modules │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-310.pyc │ │ ├── block.cpython-310.pyc │ │ ├── conv.cpython-310.pyc │ │ ├── head.cpython-310.pyc │ │ ├── transformer.cpython-310.pyc │ │ └── utils.cpython-310.pyc │ ├── block.py │ ├── conv.py │ ├── head.py │ ├── transformer.py │ └── utils.py └── tasks.py ├── solutions ├── __init__.py ├── ai_gym.py ├── analytics.py ├── distance_calculation.py ├── heatmap.py ├── object_counter.py ├── parking_management.py ├── queue_management.py ├── speed_estimation.py └── streamlit_inference.py ├── trackers ├── README.md ├── __init__.py ├── basetrack.py ├── bot_sort.py ├── byte_tracker.py ├── track.py └── utils │ ├── __init__.py │ ├── gmc.py │ ├── kalman_filter.py │ └── matching.py └── utils ├── __init__.py ├── __pycache__ ├── __init__.cpython-310.pyc ├── autobatch.cpython-310.pyc ├── checks.cpython-310.pyc ├── dist.cpython-310.pyc ├── downloads.cpython-310.pyc ├── errors.cpython-310.pyc ├── files.cpython-310.pyc ├── instance.cpython-310.pyc ├── loss.cpython-310.pyc ├── metrics.cpython-310.pyc ├── ops.cpython-310.pyc ├── patches.cpython-310.pyc ├── plotting.cpython-310.pyc ├── tal.cpython-310.pyc └── torch_utils.cpython-310.pyc ├── autobatch.py ├── benchmarks.py ├── callbacks ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-310.pyc │ ├── base.cpython-310.pyc │ ├── clearml.cpython-310.pyc │ ├── comet.cpython-310.pyc │ ├── dvc.cpython-310.pyc │ ├── hub.cpython-310.pyc │ ├── mlflow.cpython-310.pyc │ ├── neptune.cpython-310.pyc │ ├── raytune.cpython-310.pyc │ ├── tensorboard.cpython-310.pyc │ └── wb.cpython-310.pyc ├── base.py ├── clearml.py ├── comet.py ├── dvc.py ├── hub.py ├── mlflow.py ├── neptune.py ├── raytune.py ├── tensorboard.py └── wb.py ├── checks.py ├── dist.py ├── downloads.py ├── errors.py ├── files.py ├── instance.py ├── loss.py ├── metrics.py ├── ops.py ├── patches.py ├── plotting.py ├── tal.py ├── torch_utils.py ├── triton.py └── tuner.py /CLIP/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__/ 2 | *.py[cod] 3 | *$py.class 4 | *.egg-info 5 | .pytest_cache 6 | .ipynb_checkpoints 7 | 8 | thumbs.db 9 | .DS_Store 10 | .idea 11 | -------------------------------------------------------------------------------- /CLIP/CLIP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/CLIP/CLIP.png -------------------------------------------------------------------------------- /CLIP/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include clip/bpe_simple_vocab_16e6.txt.gz 2 | -------------------------------------------------------------------------------- /CLIP/clip/__init__.py: -------------------------------------------------------------------------------- 1 | from .clip import * 2 | -------------------------------------------------------------------------------- /CLIP/clip/bpe_simple_vocab_16e6.txt.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/CLIP/clip/bpe_simple_vocab_16e6.txt.gz -------------------------------------------------------------------------------- /CLIP/data/country211.md: -------------------------------------------------------------------------------- 1 | # The Country211 Dataset 2 | 3 | In the paper, we used an image classification dataset called Country211, to evaluate the model's capability on geolocation. To do so, we filtered the YFCC100m dataset that have GPS coordinate corresponding to a [ISO-3166 country code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes) and created a balanced dataset by sampling 150 train images, 50 validation images, and 100 test images images for each country. 4 | 5 | The following command will download an 11GB archive countaining the images and extract into a subdirectory `country211`: 6 | 7 | ```bash 8 | wget https://openaipublic.azureedge.net/clip/data/country211.tgz 9 | tar zxvf country211.tgz 10 | ``` 11 | 12 | These images are a subset of the YFCC100m dataset. Use of the underlying media files is subject to the Creative Commons licenses chosen by their creators/uploaders. For more information about the YFCC100M dataset, visit [the official website](https://multimediacommons.wordpress.com/yfcc100m-core-dataset/). 13 | -------------------------------------------------------------------------------- /CLIP/data/rendered-sst2.md: -------------------------------------------------------------------------------- 1 | # The Rendered SST2 Dataset 2 | 3 | In the paper, we used an image classification dataset called Rendered SST2, to evaluate the model's capability on optical character recognition. To do so, we rendered the sentences in the [Standford Sentiment Treebank v2](https://nlp.stanford.edu/sentiment/treebank.html) dataset and used those as the input to the CLIP image encoder. 4 | 5 | The following command will download a 131MB archive countaining the images and extract into a subdirectory `rendered-sst2`: 6 | 7 | ```bash 8 | wget https://openaipublic.azureedge.net/clip/data/rendered-sst2.tgz 9 | tar zxvf rendered-sst2.tgz 10 | ``` 11 | -------------------------------------------------------------------------------- /CLIP/data/yfcc100m.md: -------------------------------------------------------------------------------- 1 | # The YFCC100M Subset 2 | 3 | In the paper, we performed a dataset ablation using a subset of the YFCC100M dataset and showed that the performance remained largely similar. 4 | 5 | The subset contains 14,829,396 images, about 15% of the full dataset, which have been filtered to only keep those with natural language titles and/or descriptions in English. 6 | 7 | We provide the list of (line number, photo identifier, photo hash) of each image contained in this subset. These correspond to the first three columns in the dataset's metadata TSV file. 8 | 9 | ```bash 10 | wget https://openaipublic.azureedge.net/clip/data/yfcc100m_subset_data.tsv.bz2 11 | bunzip2 yfcc100m_subset_data.tsv.bz2 12 | ``` 13 | 14 | Use of the underlying media files is subject to the Creative Commons licenses chosen by their creators/uploaders. For more information about the YFCC100M dataset, visit [the official website](https://multimediacommons.wordpress.com/yfcc100m-core-dataset/). 15 | -------------------------------------------------------------------------------- /CLIP/doc/learn.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | text = "This is a\nstring with \t irregular \n whitespace." 4 | text = re.sub(r"\s+", " ", text) 5 | print(text) 6 | # 输出: "This is a string with irregular whitespace." 7 | 8 | 9 | import ftfy 10 | 11 | text = "This is an invalid encoding: “Hello”" 12 | fixed_text = ftfy.fix_text(text) 13 | print(fixed_text) 14 | # 输出: This is an invalid encoding: “Hello” 15 | 16 | import html 17 | 18 | text = "<div>Hello</div>" 19 | unescaped_text = html.unescape(html.unescape(text)) 20 | print(unescaped_text) 21 | # 输出:
Hello
22 | 23 | 24 | text = " Hello World! " 25 | cleaned_text = text.strip() 26 | print(cleaned_text) 27 | # 输出: "Hello World!" 28 | 29 | 30 | 31 | import ftfy 32 | import html 33 | 34 | def clean_text(text): 35 | text = ftfy.fix_text(text) # 修复编码错误 36 | text = html.unescape(html.unescape(text)) # 解码 HTML 实体(包括嵌套) 37 | return text.strip() # 移除首尾空白 38 | 39 | # 测试输入 40 | raw_text = " <p>Hello, “world!”</p> " 41 | cleaned_text = clean_text(raw_text) 42 | print(cleaned_text) 43 | # 输出:

Hello, “world!”

44 | -------------------------------------------------------------------------------- /CLIP/hubconf.py: -------------------------------------------------------------------------------- 1 | import re 2 | import string 3 | 4 | from clip.clip import available_models as _available_models 5 | from clip.clip import load as _load 6 | from clip.clip import tokenize as _tokenize 7 | 8 | dependencies = ["torch", "torchvision", "ftfy", "regex", "tqdm"] 9 | 10 | # For compatibility (cannot include special characters in function name) 11 | model_functions = {model: re.sub(f"[{string.punctuation}]", "_", model) for model in _available_models()} 12 | 13 | 14 | def _create_hub_entrypoint(model): 15 | """Creates an entry point for loading the specified CLIP model with adjustable parameters.""" 16 | 17 | def entrypoint(**kwargs): 18 | return _load(model, **kwargs) 19 | 20 | entrypoint.__doc__ = f"""Loads the {model} CLIP model 21 | 22 | Parameters 23 | ---------- 24 | device : Union[str, torch.device] 25 | The device to put the loaded model 26 | 27 | jit : bool 28 | Whether to load the optimized JIT model or more hackable non-JIT model (default). 29 | 30 | download_root: str 31 | path to download the model files; by default, it uses "~/.cache/clip" 32 | 33 | Returns 34 | ------- 35 | model : torch.nn.Module 36 | The {model} CLIP model 37 | 38 | preprocess : Callable[[PIL.Image], torch.Tensor] 39 | A torchvision transform that converts a PIL image into a tensor that the returned model can take as its input 40 | """ 41 | return entrypoint 42 | 43 | 44 | def tokenize(): 45 | """Returns the _tokenize function for tokenizing input data.""" 46 | return _tokenize 47 | 48 | 49 | _entrypoints = {model_functions[model]: _create_hub_entrypoint(model) for model in _available_models()} 50 | 51 | globals().update(_entrypoints) 52 | -------------------------------------------------------------------------------- /CLIP/tar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 获取当前年份、月份和日期 4 | current_date=$(date +%Y-%m-%d) 5 | 6 | # 归档文件的路径和名称,包括年份、月份和日期 7 | archive_file="../CLIP-$current_date.tar.gz" 8 | 9 | # 要归档的目录 10 | source_directory="../CLIP" 11 | 12 | # 使用 tar 命令创建归档文件,同时排除 .pt 文件、checkpoints 和 runs 目录 13 | tar --exclude="*.pt" --exclude="$source_directory/runs" --exclude="$source_directory/datasets" -czvf "$archive_file" -C "$source_directory" . 14 | 15 | echo "Archive created: $archive_file" 16 | 17 | 18 | # alss v8-ghost v6 v8-p6 v8t -------------------------------------------------------------------------------- /CLIP/tests/test_consistency.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pytest 3 | import torch 4 | from PIL import Image 5 | 6 | import clip 7 | 8 | 9 | @pytest.mark.parametrize("model_name", clip.available_models()) 10 | def test_consistency(model_name): 11 | """Test consistency between JIT and non-JIT model outputs using CLIP for given model names.""" 12 | device = "cpu" 13 | jit_model, transform = clip.load(model_name, device=device, jit=True) 14 | py_model, _ = clip.load(model_name, device=device, jit=False) 15 | 16 | image = transform(Image.open("CLIP.png")).unsqueeze(0).to(device) 17 | text = clip.tokenize(["a diagram", "a dog", "a cat"]).to(device) 18 | 19 | with torch.no_grad(): 20 | logits_per_image, _ = jit_model(image, text) 21 | jit_probs = logits_per_image.softmax(dim=-1).cpu().numpy() 22 | 23 | logits_per_image, _ = py_model(image, text) 24 | py_probs = logits_per_image.softmax(dim=-1).cpu().numpy() 25 | 26 | assert np.allclose(jit_probs, py_probs, atol=0.01, rtol=0.1) 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |

3 |

可以一目十行的ultralytics献给宝子们

4 |

5 | 6 | 📝训练验证可视化以及数据转换等自动化脚本目录 scripts 7 | 不追求最好的方案,追求演化成本最低的方案 8 | 9 | 🤗 **论文引用以及相关介绍** 10 | * [ALSS-YOLO: An Adaptive Lightweight Channel Split and Shuffling Network for TIR Wildlife Detection in UAV Imagery](docs/ALSS-YOLO.md) 11 | 📝[paper](https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=10680397) 12 | 快速搭建模型 > `python demo/alss_yolo.py` 13 | 14 | * [Iterative Optimization Annotation Pipeline and ALSS-YOLO-Seg for Efficient Banana Plantation Segmentation in UAV Imagery](docs/ALSS-YOLO-seg.md) 15 | 📝[paper](https://www.frontiersin.org/journals/plant-science/articles/10.3389/fpls.2024.1508549/abstract) 16 | 17 | ## 文档快速索引 18 | [评估指标](docs/Metrics.md) 19 | 20 | [显示](docs/Display.md) 21 | 22 | [数据集加载和处理](docs/Datasets.md) 23 | 24 | 25 | 26 | 27 | ## 重要函数汇总 28 | 29 | 30 | ### 训练入口 31 | - self.trainer.train() 32 | 33 | 34 | ### 单卡训练 35 | - def _single_card_training(self, world_size=1): 36 | 37 | 38 | ### 获取数据集 39 | - self.train_loader = self.get_dataloader(self.trainset, batch_size=batch_size, rank=RANK, mode="train") 40 | 41 | 42 | ### 数据通过模型 43 | - self.loss, self.loss_items = self.model(batch) 44 | - def loss(self, batch, preds=None): 计算损失 45 | - x = m(x) # 前向传播 46 | 47 | ### 分割检测头 48 | - class Segment(Detect): 49 | 50 | 51 | ### 语义分割损失计算 52 | - class SegmentationLoss(DetectionLoss): 53 | 54 | ### 解析模型 55 | - def parse_model(model_dict, ch, verbose=True): 56 | 57 | 58 | ### 验证模型 59 | - self.metrics, self.fitness = self.validate() 60 | 61 | 62 | ### 前向传播 63 | - x = m(x) # run 64 | 65 | ### IOU改进 66 | 支持通过传参改变iou 67 | - def bbox_iou(box1, box2, xywh=True, GIoU=False, DIoU=False, CIoU=False, EIoU=False, SIoU=False,FineSIoU= False, WIoU=False, Focal=False, pow=1, gamma=0.5, scale=False, eps=1e-7): 68 | 69 | 70 | ### 推理阶段 71 | - preds = self.inference(new_img, *args, **kwargs) 72 | 73 | 74 | 75 | ### 分割头 76 | - elif m in {Detect, WorldDetect, Segment, Pose, OBB, ImagePoolingAttn, v10Detect} 77 | 78 | 79 | 80 | ### 预测置信度 81 | - custom = {"conf": 0.4, "batch": 1, "save": False, "mode": "predict"} 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /demo/alss_yolo.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | """ predeict """ 4 | # from ultralytics import YOLO 5 | 6 | # # Load a COCO-pretrained YOLOv8n model 7 | # # model = YOLO("../checkpoints/yolov8n.pt") 8 | # model = YOLO("ultralytics/cfg_yaml/models/ALSS-YOLO/ALSSm.yaml") 9 | # # Display model information (optional) 10 | # model.info() 11 | 12 | # # Train the model on the COCO8 example dataset for 100 epochs 13 | # # results = model.train(data="coco8.yaml", epochs=2, imgsz=640) 14 | 15 | # # Run inference with the YOLOv8n model on the 'bus.jpg' image 16 | # results = model("ultralytics/assets/bus.jpg") 17 | # results[0].show() 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | """ train """ 27 | from ultralytics import YOLO 28 | 29 | # Load a COCO-pretrained YOLOv8n model 30 | model = YOLO("ultralytics/cfg_yaml/models/ALSS-YOLO/ALSSm.yaml") 31 | 32 | #or 33 | # model = YOLO("yolov8.yaml") 34 | # Display model information (optional) 35 | model.info() 36 | 37 | # Train the model on the COCO8 example dataset for 100 epochs 38 | results = model.train(data="coco8.yaml", epochs=2, imgsz=640, IoU="FineSIoU") #CIoU FineSIoU) 39 | 40 | # Run inference with the YOLOv8n model on the 'bus.jpg' image 41 | results = model("ultralytics/assets/bus.jpg") 42 | results[0].show() -------------------------------------------------------------------------------- /demo/sam2_video_demo.py: -------------------------------------------------------------------------------- 1 | # from ultralytics import SAM 2 | 3 | # # Load a model 4 | # model = SAM("sam2.1_b.pt") 5 | 6 | # # Display model information (optional) 7 | # model.info() 8 | 9 | # # Run inference 10 | # model("demo/bedroom.mp4") 11 | 12 | 13 | from ultralytics.models.sam import SAM2VideoPredictor 14 | 15 | # Create SAM2VideoPredictor 16 | overrides = dict(conf=0.25, task="segment", mode="predict", imgsz=1024, model_name="sam2.1_t.pt") 17 | predictor = SAM2VideoPredictor(overrides=overrides) 18 | 19 | # Run inference with single point 20 | # results = predictor(source="demo/bedroom.mp4", points=[920, 470], labels=1) 21 | 22 | # Run inference with multiple points 23 | results = predictor(source="demo/bedroom.mp4", points=[[920, 470], [909, 138]], labels=[1, 1]) #一张图片两个点,两个标签 24 | 25 | # Run inference with multiple points prompt per object 26 | results = predictor(source="demo/bedroom.mp4", points=[[[920, 470], [909, 138]]], labels=[[1, 1]]) 27 | 28 | # Run inference with negative points prompt 29 | results = predictor(source="demo/bedroom.mp4", points=[[[920, 470], [909, 138]]], labels=[[1, 0]]) -------------------------------------------------------------------------------- /demo/yolov8.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | """ predeict """ 4 | from ultralytics import YOLO 5 | 6 | # Load a COCO-pretrained YOLOv8n model 7 | model = YOLO("../checkpoints/yolov8n.pt") 8 | # model = YOLO("yolov8.yaml") 9 | # Display model information (optional) 10 | model.info() 11 | 12 | # Train the model on the COCO8 example dataset for 100 epochs 13 | # results = model.train(data="coco8.yaml", epochs=100, imgsz=640) 14 | 15 | # Run inference with the YOLOv8n model on the 'bus.jpg' image 16 | results = model("ultralytics/assets/bus.jpg") 17 | results[0].show() 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | """ train """ 26 | from ultralytics import YOLO 27 | 28 | # Load a COCO-pretrained YOLOv8n model 29 | model = YOLO("../checkpoints/yolov8n.pt") 30 | 31 | #or 32 | # model = YOLO("yolov8.yaml") 33 | # Display model information (optional) 34 | model.info() 35 | 36 | # Train the model on the COCO8 example dataset for 100 epochs 37 | results = model.train(data="coco8.yaml", epochs=100, imgsz=640) 38 | 39 | # Run inference with the YOLOv8n model on the 'bus.jpg' image 40 | results = model("ultralytics/assets/bus.jpg") 41 | results[0].show() -------------------------------------------------------------------------------- /docs/CITATION.cff: -------------------------------------------------------------------------------- 1 | # This CITATION.cff file was generated with https://bit.ly/cffinit 2 | 3 | cff-version: 1.2.0 4 | title: Ultralytics YOLO 5 | message: >- 6 | If you use this software, please cite it using the 7 | metadata from this file. 8 | type: software 9 | authors: 10 | - given-names: Glenn 11 | family-names: Jocher 12 | affiliation: Ultralytics 13 | orcid: 'https://orcid.org/0000-0001-5950-6979' 14 | - given-names: Ayush 15 | family-names: Chaurasia 16 | affiliation: Ultralytics 17 | orcid: 'https://orcid.org/0000-0002-7603-6750' 18 | - family-names: Qiu 19 | given-names: Jing 20 | affiliation: Ultralytics 21 | orcid: 'https://orcid.org/0000-0003-3783-7069' 22 | repository-code: 'https://github.com/ultralytics/ultralytics' 23 | url: 'https://ultralytics.com' 24 | license: AGPL-3.0 25 | version: 8.0.0 26 | date-released: '2023-01-10' 27 | -------------------------------------------------------------------------------- /docs/Datasets.md: -------------------------------------------------------------------------------- 1 | ## 数据集中父类和子类的关系图 2 | ` 3 | class BaseDataset(Dataset):`-> `class YOLODataset(BaseDataset):` 4 | ->`class SemanticDataset(BaseDataset):` -------------------------------------------------------------------------------- /docs/Display.md: -------------------------------------------------------------------------------- 1 | ## 显示 2 | 3 | 4 | #### 预测标签显示 5 | `label = (f"{conf:.2f}" if conf else name) if labels else None` 6 | 7 | 8 | #### 训练结果评估指标画图 9 | ```python 10 | plot_pr_curve(x, prec_values, ap, save_dir / f"{prefix}PR_curve.png", names, on_plot=on_plot) 11 | plot_mc_curve(x, f1_curve, save_dir / f"{prefix}F1_curve.png", names, ylabel="F1", on_plot=on_plot) 12 | plot_mc_curve(x, p_curve, save_dir / f"{prefix}P_curve.png", names, ylabel="Precision", on_plot=on_plot) 13 | plot_mc_curve(x, r_curve, save_dir / f"{prefix}R_curve.png", names, ylabel="Recall", on_plot=on_plot) 14 | ``` -------------------------------------------------------------------------------- /docs/IOU.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | #### IOU函数 4 | ```python 5 | def bbox_iou(box1, box2, xywh=True, GIoU=False, DIoU=False, CIoU=False, EIoU=False, SIoU=False,FineSIoU= False, WIoU=False, Focal=False, pow=1, gamma=0.5, scale=False, eps=1e-7): 6 | ``` 7 | 8 | 9 | #### 标签分配 10 | ```python 11 | class TaskAlignedAssigner(nn.Module): 12 | def iou_calculation(self, gt_bboxes, pd_bboxes): 13 | """IoU calculation for horizontal bounding boxes.""" 14 | IoU_options = { 15 | "GIoU": False, 16 | "DIoU": False, 17 | "CIoU": False, 18 | "EIoU": False, 19 | "SIoU": False, 20 | "FineSIoU": False, 21 | "WIoU": False 22 | } 23 | if self.IoU_algorithm in IoU_options: 24 | IoU_options[self.IoU_algorithm] = True 25 | else: 26 | raise ValueError(f"Unsupported IOU algorithm: {self.IoU_algorithm}") 27 | return bbox_iou(gt_bboxes, pd_bboxes, xywh=False, **IoU_options).squeeze(-1).clamp_(0) 28 | ``` 29 | 30 | #### bbox损失 31 | ```python 32 | class BboxLoss(nn.Module): 33 | def forward(self, pd_dist, pd_bboxes_pyramid, anc_points, target_scores, target_bboxes_pyramid, target_scores_sum, match_bool, mpdiou_hw=None): 34 | """IoU loss.""" 35 | weight = target_scores.sum(-1)[match_bool].unsqueeze(-1) #torch.Size([2, 8400, 80]) 36 | 37 | IoU_options = { 38 | "GIoU": False, 39 | "DIoU": False, 40 | "CIoU": False, 41 | "EIoU": False, 42 | "SIoU": False, 43 | "FineSIoU": False, 44 | "WIoU": False 45 | } 46 | if self.IoU_algorithm in IoU_options: 47 | IoU_options[self.IoU_algorithm] = True 48 | else: 49 | raise ValueError(f"Unsupported IOU algorithm: {self.IoU_algorithm}") 50 | iou = bbox_iou(pd_bboxes_pyramid[match_bool], target_bboxes_pyramid[match_bool], xywh=False, **IoU_options) 51 | ``` -------------------------------------------------------------------------------- /docs/Metrics.md: -------------------------------------------------------------------------------- 1 | ## 验证参数解读 2 | 3 | 4 | ### 实例分割评估 5 | SegmentMetrics 6 | 7 | 8 | #### 混淆矩阵中的置信度默认0.25 iou默认为5 9 | ```python 10 | self.confusion_matrix_conf = 0.25 if conf in {None, 0.001} else conf # apply 0.25 if default val conf is passed 11 | self.confusion_matrix_iou = confusion_matrix_iou #iou默认5 12 | ``` 13 | 14 | 15 | #### 验证集中预测框非极大值抑制的置信度为0.001 非极大值抑制iou为0.7 注意这个iou和常规理解的iou不同,仅仅作为一个阈值 此步骤的非极大值抑制是为了过滤部分预测信息 包扩bbox cls置信度 cls索引 mask信息(语义分割) 16 | 17 | ```python 18 | assert 0 <= conf_thres <= 1, f"Invalid Confidence threshold {conf_thres}, valid values are between 0.0 and 1.0" 19 | assert 0 <= iou_thres <= 1, f"Invalid IoU {iou_thres}, valid values are between 0.0 and 1.0" 20 | ``` 21 | 22 | #### 代码给出的精度召回率是在 iou为0.5的情况下最佳F1值对应的置信度下的值 23 | ```python 24 | # Recall 25 | recall = tpc / (n_l + eps) # recall curve #(3737, 10) 26 | r_curve[ci] = np.interp(-x, -conf[i], recall[:, 0], left=0) # negative x, xp because xp decreases iou阈值是0.5 27 | 28 | # Precision 29 | precision = tpc / (tpc + fpc) # precision curve 30 | p_curve[ci] = np.interp(-x, -conf[i], precision[:, 0], left=1) # p at pr_score 31 | 32 | i = smooth(f1_curve.mean(0), 0.1).argmax() # max F1 index 33 | p, r, f1 = p_curve[:, i], r_curve[:, i], f1_curve[:, i] # max-F1 precision, recall, F1 values 34 | tp = (r * unique_gt_cls_num).round() # true positives 35 | fp = (tp / (p + eps) - tp).round() # false positives 36 | ``` -------------------------------------------------------------------------------- /docs/迭代优化的标注工作流.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/docs/迭代优化的标注工作流.PNG -------------------------------------------------------------------------------- /examples/YOLOv8-CPP-Inference/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | project(Yolov8CPPInference VERSION 0.1) 4 | 5 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 6 | 7 | # CUDA 8 | set(CUDA_TOOLKIT_ROOT_DIR "/usr/local/cuda") 9 | find_package(CUDA 11 REQUIRED) 10 | 11 | set(CMAKE_CUDA_STANDARD 11) 12 | set(CMAKE_CUDA_STANDARD_REQUIRED ON) 13 | # !CUDA 14 | 15 | # OpenCV 16 | find_package(OpenCV REQUIRED) 17 | include_directories(${OpenCV_INCLUDE_DIRS}) 18 | # !OpenCV 19 | 20 | set(PROJECT_SOURCES 21 | main.cpp 22 | 23 | inference.h 24 | inference.cpp 25 | ) 26 | 27 | add_executable(Yolov8CPPInference ${PROJECT_SOURCES}) 28 | target_link_libraries(Yolov8CPPInference ${OpenCV_LIBS}) 29 | -------------------------------------------------------------------------------- /examples/YOLOv8-CPP-Inference/README.md: -------------------------------------------------------------------------------- 1 | # YOLOv8/YOLOv5 Inference C++ 2 | 3 | This example demonstrates how to perform inference using YOLOv8 and YOLOv5 models in C++ with OpenCV's DNN API. 4 | 5 | ## Usage 6 | 7 | ```bash 8 | git clone ultralytics 9 | cd ultralytics 10 | pip install . 11 | cd examples/YOLOv8-CPP-Inference 12 | 13 | # Add a **yolov8\_.onnx** and/or **yolov5\_.onnx** model(s) to the ultralytics folder. 14 | # Edit the **main.cpp** to change the **projectBasePath** to match your user. 15 | 16 | # Note that by default the CMake file will try to import the CUDA library to be used with the OpenCVs dnn (cuDNN) GPU Inference. 17 | # If your OpenCV build does not use CUDA/cuDNN you can remove that import call and run the example on CPU. 18 | 19 | mkdir build 20 | cd build 21 | cmake .. 22 | make 23 | ./Yolov8CPPInference 24 | ``` 25 | 26 | ## Exporting YOLOv8 and YOLOv5 Models 27 | 28 | To export YOLOv8 models: 29 | 30 | ```commandline 31 | yolo export model=yolov8s.pt imgsz=480,640 format=onnx opset=12 32 | ``` 33 | 34 | To export YOLOv5 models: 35 | 36 | ```commandline 37 | python3 export.py --weights yolov5s.pt --img 480 640 --include onnx --opset 12 38 | ``` 39 | 40 | yolov8s.onnx: 41 | 42 | ![image](https://user-images.githubusercontent.com/40023722/217356132-a4cecf2e-2729-4acb-b80a-6559022d7707.png) 43 | 44 | yolov5s.onnx: 45 | 46 | ![image](https://user-images.githubusercontent.com/40023722/217357005-07464492-d1da-42e3-98a7-fc753f87d5e6.png) 47 | 48 | This repository utilizes OpenCV's DNN API to run ONNX exported models of YOLOv5 and YOLOv8. In theory, it should work for YOLOv6 and YOLOv7 as well, but they have not been tested. Note that the example networks are exported with rectangular (640x480) resolutions, but any exported resolution will work. You may want to use the letterbox approach for square images, depending on your use case. 49 | 50 | The **main** branch version uses Qt as a GUI wrapper. The primary focus here is the **Inference** class file, which demonstrates how to transpose YOLOv8 models to work as YOLOv5 models. 51 | -------------------------------------------------------------------------------- /examples/YOLOv8-LibTorch-CPP-Inference/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.18 FATAL_ERROR) 2 | 3 | project(yolov8_libtorch_example) 4 | 5 | set(CMAKE_CXX_STANDARD 17) 6 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 7 | set(CMAKE_CXX_EXTENSIONS OFF) 8 | 9 | 10 | # -------------- OpenCV -------------- 11 | set(OpenCV_DIR "/path/to/opencv/lib/cmake/opencv4") 12 | find_package(OpenCV REQUIRED) 13 | 14 | message(STATUS "OpenCV library status:") 15 | message(STATUS " config: ${OpenCV_DIR}") 16 | message(STATUS " version: ${OpenCV_VERSION}") 17 | message(STATUS " libraries: ${OpenCV_LIBS}") 18 | message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") 19 | 20 | include_directories(${OpenCV_INCLUDE_DIRS}) 21 | 22 | # -------------- libtorch -------------- 23 | list(APPEND CMAKE_PREFIX_PATH "/path/to/libtorch") 24 | set(Torch_DIR "/path/to/libtorch/share/cmake/Torch") 25 | 26 | find_package(Torch REQUIRED) 27 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}") 28 | message("${TORCH_LIBRARIES}") 29 | message("${TORCH_INCLUDE_DIRS}") 30 | 31 | # The following code block is suggested to be used on Windows. 32 | # According to https://github.com/pytorch/pytorch/issues/25457, 33 | # the DLLs need to be copied to avoid memory errors. 34 | # if (MSVC) 35 | # file(GLOB TORCH_DLLS "${TORCH_INSTALL_PREFIX}/lib/*.dll") 36 | # add_custom_command(TARGET yolov8_libtorch_example 37 | # POST_BUILD 38 | # COMMAND ${CMAKE_COMMAND} -E copy_if_different 39 | # ${TORCH_DLLS} 40 | # $) 41 | # endif (MSVC) 42 | 43 | include_directories(${TORCH_INCLUDE_DIRS}) 44 | 45 | add_executable(yolov8_libtorch_inference "${CMAKE_CURRENT_SOURCE_DIR}/main.cc") 46 | target_link_libraries(yolov8_libtorch_inference ${TORCH_LIBRARIES} ${OpenCV_LIBS}) 47 | set_property(TARGET yolov8_libtorch_inference PROPERTY CXX_STANDARD 17) 48 | -------------------------------------------------------------------------------- /examples/YOLOv8-LibTorch-CPP-Inference/README.md: -------------------------------------------------------------------------------- 1 | # YOLOv8 LibTorch Inference C++ 2 | 3 | This example demonstrates how to perform inference using YOLOv8 models in C++ with LibTorch API. 4 | 5 | ## Dependencies 6 | 7 | | Dependency | Version | 8 | | ------------ | -------- | 9 | | OpenCV | >=4.0.0 | 10 | | C++ Standard | >=17 | 11 | | Cmake | >=3.18 | 12 | | Libtorch | >=1.12.1 | 13 | 14 | ## Usage 15 | 16 | ```bash 17 | git clone ultralytics 18 | cd ultralytics 19 | pip install . 20 | cd examples/YOLOv8-LibTorch-CPP-Inference 21 | 22 | mkdir build 23 | cd build 24 | cmake .. 25 | make 26 | ./yolov8_libtorch_inference 27 | ``` 28 | 29 | ## Exporting YOLOv8 30 | 31 | To export YOLOv8 models: 32 | 33 | ```commandline 34 | yolo export model=yolov8s.pt imgsz=640 format=torchscript 35 | ``` 36 | -------------------------------------------------------------------------------- /examples/YOLOv8-ONNXRuntime-Rust/Cargo.toml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | [package] 4 | name = "yolov8-rs" 5 | version = "0.1.0" 6 | edition = "2021" 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [dependencies] 11 | clap = { version = "4.2.4", features = ["derive"] } 12 | image = { version = "0.24.7", default-features = false, features = ["jpeg", "png", "webp-encoder"] } 13 | imageproc = { version = "0.23.0", default-features = false } 14 | ndarray = { version = "0.15.6" } 15 | ort = { version = "1.16.3", default-features = false, features = ["load-dynamic", "copy-dylibs", "half"] } 16 | rusttype = { version = "0.9", default-features = false } 17 | anyhow = { version = "1.0.75" } 18 | regex = { version = "1.5.4" } 19 | rand = { version = "0.8.5" } 20 | chrono = { version = "0.4.30" } 21 | half = { version = "2.3.1" } 22 | dirs = { version = "5.0.1" } 23 | ureq = { version = "2.9.1" } 24 | -------------------------------------------------------------------------------- /examples/YOLOv8-ONNXRuntime-Rust/src/main.rs: -------------------------------------------------------------------------------- 1 | use clap::Parser; 2 | 3 | use yolov8_rs::{Args, YOLOv8}; 4 | 5 | fn main() -> Result<(), Box> { 6 | let args = Args::parse(); 7 | 8 | // 1. load image 9 | let x = image::io::Reader::open(&args.source)? 10 | .with_guessed_format()? 11 | .decode()?; 12 | 13 | // 2. model support dynamic batch inference, so input should be a Vec 14 | let xs = vec![x]; 15 | 16 | // You can test `--batch 2` with this 17 | // let xs = vec![x.clone(), x]; 18 | 19 | // 3. build yolov8 model 20 | let mut model = YOLOv8::new(args)?; 21 | model.summary(); // model info 22 | 23 | // 4. run 24 | let ys = model.run(&xs)?; 25 | println!("{:?}", ys); 26 | 27 | Ok(()) 28 | } 29 | -------------------------------------------------------------------------------- /examples/YOLOv8-ONNXRuntime/README.md: -------------------------------------------------------------------------------- 1 | # YOLOv8 - ONNX Runtime 2 | 3 | This project implements YOLOv8 using ONNX Runtime. 4 | 5 | ## Installation 6 | 7 | To run this project, you need to install the required dependencies. The following instructions will guide you through the installation process. 8 | 9 | ### Installing Required Dependencies 10 | 11 | You can install the required dependencies by running the following command: 12 | 13 | ```bash 14 | pip install -r requirements.txt 15 | ``` 16 | 17 | ### Installing `onnxruntime-gpu` 18 | 19 | If you have an NVIDIA GPU and want to leverage GPU acceleration, you can install the onnxruntime-gpu package using the following command: 20 | 21 | ```bash 22 | pip install onnxruntime-gpu 23 | ``` 24 | 25 | Note: Make sure you have the appropriate GPU drivers installed on your system. 26 | 27 | ### Installing `onnxruntime` (CPU version) 28 | 29 | If you don't have an NVIDIA GPU or prefer to use the CPU version of onnxruntime, you can install the onnxruntime package using the following command: 30 | 31 | ```bash 32 | pip install onnxruntime 33 | ``` 34 | 35 | ### Usage 36 | 37 | After successfully installing the required packages, you can run the YOLOv8 implementation using the following command: 38 | 39 | ```bash 40 | python main.py --model yolov8n.onnx --img image.jpg --conf-thres 0.5 --iou-thres 0.5 41 | ``` 42 | 43 | Make sure to replace yolov8n.onnx with the path to your YOLOv8 ONNX model file, image.jpg with the path to your input image, and adjust the confidence threshold (conf-thres) and IoU threshold (iou-thres) values as needed. 44 | -------------------------------------------------------------------------------- /examples/YOLOv8-OpenCV-ONNX-Python/README.md: -------------------------------------------------------------------------------- 1 | # YOLOv8 - OpenCV 2 | 3 | Implementation YOLOv8 on OpenCV using ONNX Format. 4 | 5 | Just simply clone and run 6 | 7 | ```bash 8 | pip install -r requirements.txt 9 | python main.py --model yolov8n.onnx --img image.jpg 10 | ``` 11 | 12 | If you start from scratch: 13 | 14 | ```bash 15 | pip install ultralytics 16 | yolo export model=yolov8n.pt imgsz=640 format=onnx opset=12 17 | ``` 18 | 19 | _\*Make sure to include "opset=12"_ 20 | -------------------------------------------------------------------------------- /examples/YOLOv8-OpenVINO-CPP-Inference/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.12) 2 | project(yolov8_openvino_example) 3 | 4 | set(CMAKE_CXX_STANDARD 14) 5 | 6 | find_package(OpenCV REQUIRED) 7 | 8 | include_directories( 9 | ${OpenCV_INCLUDE_DIRS} 10 | /path/to/intel/openvino/runtime/include 11 | ) 12 | 13 | add_executable(detect 14 | main.cc 15 | inference.cc 16 | ) 17 | 18 | target_link_libraries(detect 19 | ${OpenCV_LIBS} 20 | /path/to/intel/openvino/runtime/lib/intel64/libopenvino.so 21 | ) 22 | -------------------------------------------------------------------------------- /examples/YOLOv8-OpenVINO-CPP-Inference/main.cc: -------------------------------------------------------------------------------- 1 | #include "inference.h" 2 | 3 | #include 4 | #include 5 | 6 | int main(int argc, char **argv) { 7 | // Check if the correct number of arguments is provided 8 | if (argc != 3) { 9 | std::cerr << "usage: " << argv[0] << " " << std::endl; 10 | return 1; 11 | } 12 | 13 | // Get the model and image paths from the command-line arguments 14 | const std::string model_path = argv[1]; 15 | const std::string image_path = argv[2]; 16 | 17 | // Read the input image 18 | cv::Mat image = cv::imread(image_path); 19 | 20 | // Check if the image was successfully loaded 21 | if (image.empty()) { 22 | std::cerr << "ERROR: image is empty" << std::endl; 23 | return 1; 24 | } 25 | 26 | // Define the confidence and NMS thresholds 27 | const float confidence_threshold = 0.5; 28 | const float NMS_threshold = 0.5; 29 | 30 | // Initialize the YOLO inference with the specified model and parameters 31 | yolo::Inference inference(model_path, cv::Size(640, 640), confidence_threshold, NMS_threshold); 32 | 33 | // Run inference on the input image 34 | inference.RunInference(image); 35 | 36 | // Display the image with the predn 37 | cv::imshow("image", image); 38 | cv::waitKey(0); 39 | 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/.gitattributes: -------------------------------------------------------------------------------- 1 | *.7z filter=lfs diff=lfs merge=lfs -text 2 | *.arrow filter=lfs diff=lfs merge=lfs -text 3 | *.bin filter=lfs diff=lfs merge=lfs -text 4 | *.bz2 filter=lfs diff=lfs merge=lfs -text 5 | *.ckpt filter=lfs diff=lfs merge=lfs -text 6 | *.ftz filter=lfs diff=lfs merge=lfs -text 7 | *.gz filter=lfs diff=lfs merge=lfs -text 8 | *.h5 filter=lfs diff=lfs merge=lfs -text 9 | *.joblib filter=lfs diff=lfs merge=lfs -text 10 | *.lfs.* filter=lfs diff=lfs merge=lfs -text 11 | *.mlmodel filter=lfs diff=lfs merge=lfs -text 12 | *.model filter=lfs diff=lfs merge=lfs -text 13 | *.msgpack filter=lfs diff=lfs merge=lfs -text 14 | *.npy filter=lfs diff=lfs merge=lfs -text 15 | *.npz filter=lfs diff=lfs merge=lfs -text 16 | *.onnx filter=lfs diff=lfs merge=lfs -text 17 | *.ot filter=lfs diff=lfs merge=lfs -text 18 | *.parquet filter=lfs diff=lfs merge=lfs -text 19 | *.pb filter=lfs diff=lfs merge=lfs -text 20 | *.pickle filter=lfs diff=lfs merge=lfs -text 21 | *.pkl filter=lfs diff=lfs merge=lfs -text 22 | *.pt filter=lfs diff=lfs merge=lfs -text 23 | *.pth filter=lfs diff=lfs merge=lfs -text 24 | *.rar filter=lfs diff=lfs merge=lfs -text 25 | *.safetensors filter=lfs diff=lfs merge=lfs -text 26 | saved_model/**/* filter=lfs diff=lfs merge=lfs -text 27 | *.tar.* filter=lfs diff=lfs merge=lfs -text 28 | *.tflite filter=lfs diff=lfs merge=lfs -text 29 | *.tgz filter=lfs diff=lfs merge=lfs -text 30 | *.wasm filter=lfs diff=lfs merge=lfs -text 31 | *.xz filter=lfs diff=lfs merge=lfs -text 32 | *.zip filter=lfs diff=lfs merge=lfs -text 33 | *.zst filter=lfs diff=lfs merge=lfs -text 34 | *tfevents* filter=lfs diff=lfs merge=lfs -text 35 | img_examples/MichaelMiley.jpg filter=lfs diff=lfs merge=lfs -text 36 | fonts/malgun.ttf filter=lfs diff=lfs merge=lfs -text 37 | fonts/SimSun.ttf filter=lfs diff=lfs merge=lfs -text 38 | -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/.gitignore: -------------------------------------------------------------------------------- 1 | # 图片格式 2 | *.jpg 3 | *.jpeg 4 | *.png 5 | *.svg 6 | *.gif 7 | 8 | # 视频格式 9 | *.mp4 10 | *.avi 11 | .ipynb_checkpoints 12 | */__pycache__ 13 | 14 | # 日志格式 15 | *.log 16 | *.datas 17 | # *.txt 18 | 19 | # 生成文件 20 | *.pdf 21 | *.xlsx 22 | *.csv 23 | 24 | # 参数文件 25 | *.yaml 26 | *.json 27 | 28 | # 压缩文件格式 29 | *.zip 30 | *.tar 31 | *.tar.gz 32 | *.rar 33 | 34 | # 字体格式 35 | *.ttc 36 | *.ttf 37 | *.otf 38 | 39 | # 模型文件 40 | *.pt 41 | *.db 42 | 43 | /flagged 44 | /run 45 | !requirements.txt 46 | !cls_name/* 47 | !model_config/* 48 | !img_examples/* 49 | !packages.txt 50 | 51 | app copy.py -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Gradio YOLOv8 Det 3 | emoji: 🚀 4 | colorFrom: red 5 | colorTo: red 6 | sdk: gradio 7 | sdk_version: 4.12.0 8 | app_file: app.py 9 | pinned: true 10 | license: gpl-3.0 11 | --- 12 | 13 | Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference 14 | -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = "Gradio YOLO" 2 | 3 | print( 4 | f"[bold blue] 🚀 欢迎使用 Gradio YOLOv8 Det {__version__} \n具体内容参见源码地址:https://gitee.com/CV_Lab/gradio-yolov8-det ang在此基础上进行改动[/bold blue]" 5 | ) -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/img_examples/0000000349_0000000000_0000000489.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/scripts/Gradio-YOLO/img_examples/0000000349_0000000000_0000000489.jpg -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/img_examples/0000000353_0000000000_0000000652.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/scripts/Gradio-YOLO/img_examples/0000000353_0000000000_0000000652.jpg -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/img_examples/20241217-095819.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/scripts/Gradio-YOLO/img_examples/20241217-095819.jpg -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/img_examples/DJI_20240323110116_0053_D.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/scripts/Gradio-YOLO/img_examples/DJI_20240323110116_0053_D.jpg -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/img_examples/DJI_20240323112100_0019_D.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/scripts/Gradio-YOLO/img_examples/DJI_20240323112100_0019_D.jpg -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/img_examples/DJI_20240323135316_0031_D.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/scripts/Gradio-YOLO/img_examples/DJI_20240323135316_0031_D.jpg -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/img_examples/DJI_20240323174441_0222_D.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/scripts/Gradio-YOLO/img_examples/DJI_20240323174441_0222_D.jpg -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/img_examples/ILSVRC2012_val_00000008.JPEG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/scripts/Gradio-YOLO/img_examples/ILSVRC2012_val_00000008.JPEG -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/img_examples/ILSVRC2012_val_00000018.JPEG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/scripts/Gradio-YOLO/img_examples/ILSVRC2012_val_00000018.JPEG -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/img_examples/ILSVRC2012_val_00000023.JPEG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/scripts/Gradio-YOLO/img_examples/ILSVRC2012_val_00000023.JPEG -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/img_examples/ILSVRC2012_val_00000067.JPEG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/scripts/Gradio-YOLO/img_examples/ILSVRC2012_val_00000067.JPEG -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/img_examples/ILSVRC2012_val_00000077.JPEG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/scripts/Gradio-YOLO/img_examples/ILSVRC2012_val_00000077.JPEG -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/img_examples/bus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/scripts/Gradio-YOLO/img_examples/bus.jpg -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/img_examples/zidane.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/scripts/Gradio-YOLO/img_examples/zidane.jpg -------------------------------------------------------------------------------- /scripts/Gradio-YOLO/requirements.txt: -------------------------------------------------------------------------------- 1 | ultralytics>=8.0.223 2 | gradio>=4.8.0 3 | gradio_imageslider 4 | opencv-python 5 | matplotlib 6 | numpy 7 | pandas 8 | pyyaml 9 | pillow>=10.1.0 10 | wget>=3.2 11 | rich>=12.2.0 -------------------------------------------------------------------------------- /scripts/bug_test.py: -------------------------------------------------------------------------------- 1 | # from ultralytics import YOLO 2 | 3 | # # Load a model 4 | # model = YOLO("yolov8n-seg.pt") # load an official model 5 | # # model = YOLO("path/to/best.pt") # load a custom model 6 | 7 | # # Predict with the model 8 | # results = model("https://ultralytics.com/images/bus.jpg") # predict on an image 9 | import torch 10 | from ultralytics import YOLO 11 | 12 | import sys 13 | import os 14 | 15 | # 获取上一级目录 16 | parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) 17 | sys.path.append(parent_dir) 18 | 19 | from scripts.utile.free_cuda import get_free_gpu # type: ignore 20 | device = torch.device(f"cuda:{get_free_gpu(start_index=0)}") 21 | 22 | # from ultralytics import YOLO 23 | 24 | 25 | if __name__=="__main__": 26 | 27 | # model1 = YOLO("../checkpoints/yolov8n-seg.pt") # load an official model 28 | # metrics = model1.train(data='ultralytics/cfg_yaml/datasets/coco128-seg.yaml',device="0",project="debug",epochs=1,batch=2) 29 | 30 | 31 | model2 = YOLO(model='yolov8n-seg.yaml') 32 | metrics = model2.train(data='ultralytics/cfg_yaml/datasets/coco128-seg.yaml',device="0",project="debug",epochs=3,batch=2) 33 | 34 | # model3 = YOLO(model='../checkpoints/yolov8n.pt') 35 | # metrics = model3.train(data='ultralytics/cfg_yaml/datasets/coco128.yaml',device="0",project="debug",epochs=3,batch=2) 36 | 37 | # model4 = YOLO(model='yolov8s.yaml') 38 | # metrics = model4.train(data='ultralytics/cfg_yaml/datasets/coco128.yaml',device="0",project="debug",epochs=3,batch=2) 39 | 40 | print("1") 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /scripts/predict/predict_v2.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | import warnings 5 | warnings.filterwarnings('ignore') 6 | from scripts.predict.preditct_config import * 7 | from ultralytics import YOLO 8 | from scripts.utile.send_notice import send_notice_by_task 9 | 10 | 11 | if __name__ == '__main__': 12 | model1 = YOLO("yolov8s-seg.pt") 13 | 14 | model1.predict(source="scripts/assets/zidane_640.jpg", 15 | imgsz=640, 16 | project='runs/predict', 17 | name=name1, 18 | save=True, 19 | device=device, 20 | batch=batch, 21 | ch=3, 22 | conf = 0.3, 23 | show_labels = show_labels 24 | # visualize=True # visualize model features maps 25 | ) 26 | 27 | # send_notice_by_task(metrics,task) -------------------------------------------------------------------------------- /scripts/predict/preditct_config.py: -------------------------------------------------------------------------------- 1 | 2 | from pathlib import Path 3 | 4 | # # 获取当前脚本的相对路径 5 | # current_file_path = Path(__file__) 6 | # current_directory = current_file_path.parent 7 | # data = str(current_directory / Path('../../../datasets/RM-RDD/RM-RDD-20.yaml')) 8 | # # datasets/BIRDSAI-FORE-BACKUP1.1/BIRDSAI-FORE.yaml 9 | 10 | model_yaml1='Gradio-YOLO/checkpoints/ALSS-YOLO-seg.pt' 11 | model_yaml2='/home/easyits/ang/exp/RM-RDD_COMP_EXP/yolov6s.yaml/weights/best.pt' 12 | model_yaml3='/home/easyits/ang/exp/RM-RDD_COMP_EXP/yolov8s.yaml/weights/best.pt' 13 | model_yaml4='/home/easyits/ang/exp/RM-RDD_COMP_EXP/yolov9s_0.653/weights/best.pt' 14 | model_yaml5='/home/easyits/ang/exp/RM-RDD_COMP_EXP/yolov10/weights/best.pt' 15 | model_yaml6='/home/easyits/ang/exp/RM-RDD_COMP_EXP/yolov11s.yaml/weights/best.pt' 16 | 17 | model_yaml7='/home/easyits/ang/RM-RDD_COMP_EXP/yolov10/weights/best.pt' 18 | model_yaml8='/home/easyits/ang/RM-RDD_COMP_EXP/yolov11s.yaml/weights/best.pt' 19 | fraction = 1 20 | 21 | project='temp' 22 | name1='yolov5s' 23 | name2='yolov6s' 24 | name3='yolov8S' 25 | name4='yolov9s' 26 | name5='yolov10s' 27 | name6='yolov11s' 28 | 29 | name7='yolov10s' 30 | name8='yolov11s' 31 | # 批 模 名 32 | device='0' 33 | 34 | source = 'Gradio-YOLO/img_examples/0000000353_0000000000_0000000652.jpg' 35 | 36 | batch = 20 37 | 38 | show_labels = True -------------------------------------------------------------------------------- /scripts/predict/track.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/scripts/predict/track.py -------------------------------------------------------------------------------- /scripts/train/train1.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | warnings.filterwarnings('ignore') 3 | from scripts.train.train_config import * 4 | from ultralytics import YOLO 5 | from scripts.utile.send_notice import send_notice_by_task 6 | 7 | 8 | if __name__ == '__main__': 9 | model = YOLO(model=model_yaml1,task=task) 10 | 11 | metrics = model.train(data=data1, 12 | batch=batch1, 13 | IoU=IoU1, 14 | cache=False, 15 | imgsz=640, 16 | 17 | # close_mosaic=10, 18 | # workers=4, 19 | # optimizer='SGD', # using SGD 20 | 21 | val_interval=val_interval, 22 | resume=resume, # last.pt path 23 | # amp=False # close amp 24 | # fraction=0.2, 25 | task=task, 26 | project=project, 27 | name=name1, 28 | device= device, 29 | epochs=epochs, 30 | 31 | 32 | patience = patience, 33 | 34 | ) 35 | 36 | send_notice_by_task(metrics,task) 37 | 38 | 39 | 40 | 41 | 42 | 43 | # Model summary: 251 layers, 1,577,473 parameters, 1,577,457 gradients, 8.2 GFLOPs -------------------------------------------------------------------------------- /scripts/train/train2.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | warnings.filterwarnings('ignore') 3 | from scripts.train.train_config import * 4 | from ultralytics import YOLO 5 | from scripts.utile.send_notice import send_notice_by_task 6 | 7 | 8 | if __name__ == '__main__': 9 | model = YOLO(model=model_yaml2,task=task) 10 | 11 | metrics = model.train(data=data2, 12 | batch=batch2, 13 | IoU=IoU2, 14 | cache=False, 15 | imgsz=640, 16 | 17 | # close_mosaic=10, 18 | # workers=4, 19 | # optimizer='SGD', # using SGD 20 | 21 | val_interval=val_interval, 22 | resume=resume, # last.pt path 23 | # amp=False # close amp 24 | # fraction=0.2, 25 | task=task, 26 | project=project, 27 | name=name2, 28 | device= device, 29 | epochs=epochs, 30 | 31 | 32 | patience = patience, 33 | 34 | ) 35 | 36 | send_notice_by_task(metrics,task) 37 | 38 | 39 | 40 | 41 | 42 | 43 | # Model summary: 251 layers, 1,577,473 parameters, 1,577,457 gradients, 8.2 GFLOPs -------------------------------------------------------------------------------- /scripts/train/train3.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | warnings.filterwarnings('ignore') 3 | from scripts.train.train_config import * 4 | from ultralytics import YOLO 5 | from scripts.utile.send_notice import send_notice_by_task 6 | 7 | 8 | if __name__ == '__main__': 9 | model = YOLO(model=model_yaml3,task=task) 10 | 11 | metrics = model.train(data=data3, 12 | batch=batch3, 13 | IoU=IoU3, 14 | cache=False, 15 | imgsz=640, 16 | 17 | # close_mosaic=10, 18 | # workers=4, 19 | # optimizer='SGD', # using SGD 20 | 21 | val_interval=val_interval, 22 | resume=resume, # last.pt path 23 | # amp=False # close amp 24 | # fraction=0.2, 25 | task=task, 26 | project=project, 27 | name=name3, 28 | device= device, 29 | epochs=epochs, 30 | 31 | 32 | patience = patience, 33 | 34 | ) 35 | 36 | send_notice_by_task(metrics,task) 37 | 38 | 39 | 40 | 41 | 42 | 43 | # Model summary: 251 layers, 1,577,473 parameters, 1,577,457 gradients, 8.2 GFLOPs -------------------------------------------------------------------------------- /scripts/train/train4.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | warnings.filterwarnings('ignore') 3 | from scripts.train.train_config import * 4 | from ultralytics import YOLO 5 | from scripts.utile.send_notice import send_notice_by_task 6 | 7 | 8 | if __name__ == '__main__': 9 | model = YOLO(model=model_yaml4,task=task) 10 | 11 | metrics = model.train(data=data4, 12 | batch=batch4, 13 | IoU=IoU4, 14 | cache=False, 15 | imgsz=640, 16 | 17 | # close_mosaic=10, 18 | # workers=4, 19 | # optimizer='SGD', # using SGD 20 | 21 | val_interval=val_interval, 22 | resume=resume, # last.pt path 23 | # amp=False # close amp 24 | # fraction=0.2, 25 | task=task, 26 | project=project, 27 | name=name4, 28 | device= device, 29 | epochs=epochs, 30 | 31 | 32 | patience = patience, 33 | 34 | ) 35 | 36 | send_notice_by_task(metrics,task) 37 | 38 | 39 | 40 | 41 | 42 | 43 | # Model summary: 251 layers, 1,577,473 parameters, 1,577,457 gradients, 8.2 GFLOPs -------------------------------------------------------------------------------- /scripts/train/train5.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | warnings.filterwarnings('ignore') 3 | from scripts.train.train_config import * 4 | from ultralytics import YOLO 5 | from scripts.utile.send_notice import send_notice_by_task 6 | 7 | 8 | if __name__ == '__main__': 9 | model = YOLO(model=model_yaml5,task=task) 10 | 11 | metrics = model.train(data=data5, 12 | batch=batch5, 13 | IoU=IoU5, 14 | cache=False, 15 | imgsz=640, 16 | 17 | # close_mosaic=10, 18 | # workers=4, 19 | # optimizer='SGD', # using SGD 20 | 21 | val_interval=val_interval, 22 | resume=resume, # last.pt path 23 | # amp=False # close amp 24 | # fraction=0.2, 25 | task=task, 26 | project=project, 27 | name=name5, 28 | device= device, 29 | epochs=epochs, 30 | 31 | 32 | patience = patience, 33 | 34 | ) 35 | 36 | send_notice_by_task(metrics,task) 37 | 38 | 39 | 40 | 41 | 42 | 43 | # Model summary: 251 layers, 1,577,473 parameters, 1,577,457 gradients, 8.2 GFLOPs -------------------------------------------------------------------------------- /scripts/train/train6.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | warnings.filterwarnings('ignore') 3 | from scripts.train.train_config import * 4 | from ultralytics import YOLO 5 | from scripts.utile.send_notice import send_notice_by_task 6 | 7 | 8 | if __name__ == '__main__': 9 | model = YOLO(model=model_yaml6,task=task) 10 | 11 | metrics = model.train(data=data6, 12 | batch=batch6, 13 | IoU=IoU6, 14 | cache=False, 15 | imgsz=640, 16 | 17 | # close_mosaic=10, 18 | # workers=4, 19 | # optimizer='SGD', # using SGD 20 | 21 | val_interval=val_interval, 22 | resume=resume, # last.pt path 23 | # amp=False # close amp 24 | # fraction=0.2, 25 | task=task, 26 | project=project, 27 | name=name6, 28 | device= device, 29 | epochs=epochs, 30 | 31 | 32 | patience = patience, 33 | 34 | ) 35 | 36 | send_notice_by_task(metrics,task) 37 | 38 | 39 | 40 | 41 | 42 | 43 | # Model summary: 251 layers, 1,577,473 parameters, 1,577,457 gradients, 8.2 GFLOPs -------------------------------------------------------------------------------- /scripts/train/train7.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | warnings.filterwarnings('ignore') 3 | from scripts.train.train_config import * 4 | from ultralytics import YOLO 5 | from scripts.utile.send_notice import send_notice_by_task 6 | 7 | 8 | if __name__ == '__main__': 9 | model = YOLO(model=model_yaml7,task=task) 10 | 11 | metrics = model.train(data=data7, 12 | batch=batch7, 13 | IoU=IoU7, 14 | cache=False, 15 | imgsz=640, 16 | 17 | # close_mosaic=10, 18 | # workers=4, 19 | # optimizer='SGD', # using SGD 20 | 21 | val_interval=val_interval, 22 | resume=resume, # last.pt path 23 | # amp=False # close amp 24 | # fraction=0.2, 25 | task=task, 26 | project=project, 27 | name=name7, 28 | device= device, 29 | epochs=epochs, 30 | 31 | 32 | patience = patience, 33 | 34 | ) 35 | 36 | send_notice_by_task(metrics,task) 37 | 38 | # ['sentencepiece'] 39 | 40 | 41 | 42 | 43 | # Model summary: 251 layers, 1,577,473 parameters, 1,577,457 gradients, 8.2 GFLOPs -------------------------------------------------------------------------------- /scripts/train/train8.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | warnings.filterwarnings('ignore') 3 | from scripts.train.train_config import * 4 | from ultralytics import YOLO 5 | from scripts.utile.send_notice import send_notice_by_task 6 | 7 | 8 | if __name__ == '__main__': 9 | model = YOLO(model=model_yaml8,task=task) 10 | 11 | metrics = model.train(data=data8, 12 | batch=batch8, 13 | IoU=IoU8, 14 | cache=False, 15 | imgsz=640, 16 | 17 | # close_mosaic=10, 18 | # workers=4, 19 | # optimizer='SGD', # using SGD 20 | 21 | val_interval=val_interval, 22 | resume=resume, # last.pt path 23 | # amp=False # close amp 24 | # fraction=0.2, 25 | task=task, 26 | project=project, 27 | name=name8, 28 | device= device, 29 | epochs=epochs, 30 | 31 | 32 | patience = patience, 33 | 34 | ) 35 | 36 | send_notice_by_task(metrics,task) 37 | 38 | 39 | 40 | 41 | 42 | 43 | # Model summary: 251 layers, 1,577,473 parameters, 1,577,457 gradients, 8.2 GFLOPs -------------------------------------------------------------------------------- /scripts/train/train_config.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from pathlib import Path 4 | 5 | # 获取当前脚本的相对路径 6 | current_file_path = Path(__file__) 7 | current_directory = current_file_path.parent 8 | data1 = str(current_directory / Path('../../../datasets/RM-RDD/RM-RDD-FINE.yaml')) 9 | data2 = str(current_directory / Path('../../../datasets/RM-RDD/RM-RDD-FINE.yaml')) 10 | data3 = str(current_directory / Path('../../../datasets/RM-RDD/RM-RDD-FINE.yaml')) 11 | data4 = str(current_directory / Path('../../../datasets/RM-RDD/RM-RDD-FINE.yaml')) 12 | data5 = str(current_directory / Path('../../../datasets/RM-RDD/RM-RDD-FINE.yaml')) 13 | data6 = str(current_directory / Path('../../../datasets/RM-RDD/RM-RDD-FINE.yaml')) 14 | data7 = str(current_directory / Path('../../../datasets/RM-RDD/RM-RDD-FINE.yaml')) 15 | data8 = str(current_directory / Path('../../../datasets/RM-RDD/RM-RDD-FINE.yaml')) 16 | 17 | data1 = "VOC.yaml" 18 | data2 = "VOC.yaml" 19 | 20 | 21 | model_yaml1="ultralytics/cfg_yaml/models/ALSS-YOLO-world/ALSS-YOLO-world.yaml" 22 | model_yaml2="ultralytics/cfg_yaml/models/v8/yolov8-worldv2.yaml" 23 | 24 | model_yaml3="yolov6s.yaml" 25 | model_yaml4='yolov8s.yaml' 26 | model_yaml5='yolov9s.yaml' 27 | model_yaml6='yolov11s.yaml' 28 | model_yaml7='yolov8s-p2.yaml' 29 | model_yaml8='yolov8m-ghost.yaml' 30 | 31 | # task='segment' 32 | task='detect' 33 | 34 | project="../EXP" 35 | 36 | name1="ALSS-YOLO-world-VOC" 37 | name2="yolov8-worldv2-VOC" 38 | 39 | name3="yolov6s.yaml" 40 | name4='yolov8s.yaml' 41 | name5='yolov9s.yaml' 42 | name6='yolov11s.yaml' 43 | name7='yolov8s-p2.yaml' 44 | name8='yolov8m-ghost.yaml' 45 | 46 | 47 | # 批 模 名 48 | batch1=-1 49 | batch2=-1 50 | batch3=-1 51 | batch4=-1 52 | batch5=-1 53 | batch6=-1 54 | 55 | batch7=-1 56 | batch8=-1 57 | 58 | 59 | # CIoU or DIoU or EIoU or SIoU or FineSIoU or WIoU 60 | IoU1 = "CIoU" 61 | IoU2 = "CIoU" 62 | IoU3 = "CIoU" 63 | IoU4 = "CIoU" 64 | IoU5 = "CIoU" 65 | IoU6 = "CIoU" 66 | IoU7 = "CIoU" 67 | IoU8 = "CIoU" 68 | 69 | 70 | val_interval=1 71 | resume=False 72 | device='0' 73 | epochs=100 74 | patience=30 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /scripts/utile/10_mIoUv2.py: -------------------------------------------------------------------------------- 1 | # 定义文件路径列表 2 | file_paths = [ 3 | 'result/Ablation_experiment_exp_val/M5_con0.3_labels/1_iou_results.txt', 4 | # 'ADE20K_2016_yolo/valid_segment/MMB+20%/sam_b_labels/1_iou_results.txt', 5 | # 'ADE20K_2016_yolo/valid_segment/MMB+20%/sam_l_labels/1_iou_results.txt', 6 | # 'ADE20K_2016_yolo/valid_segment/MMB+20%/sam2_t_labels/1_iou_results.txt', 7 | # 'ADE20K_2016_yolo/valid_segment/MMB+20%/sam2_s_labels/1_iou_results.txt', 8 | # 'ADE20K_2016_yolo/valid_segment/MMB+20%/sam2_b_labels/1_iou_results.txt', 9 | # 'ADE20K_2016_yolo/valid_segment/MMB+20%/sam2_l_labels/1_iou_results.txt', 10 | ] 11 | 12 | # 定义计算平均IoU的函数 13 | def calculate_average_iou(file_path): 14 | total_iou = 0 15 | count = 0 16 | 17 | with open(file_path, 'r') as file: 18 | lines = file.readlines() 19 | 20 | # 排除最后三行 21 | for line in lines[:-3]: 22 | parts = line.strip().split(':') 23 | if len(parts) == 2: 24 | iou_value = float(parts[1].strip()) 25 | total_iou += iou_value 26 | count += 1 27 | 28 | average_iou = total_iou / count if count > 0 else 0 29 | return average_iou 30 | 31 | # 循环处理每个文件并打印平均IoU值 32 | for file_path in file_paths: 33 | avg_iou = calculate_average_iou(file_path) 34 | print(f'{file_path} 的平均IoU值: {avg_iou}') 35 | -------------------------------------------------------------------------------- /scripts/utile/11_yolo2labels.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | from ultralytics import SAM, YOLO 3 | import torch 4 | 5 | 6 | # # 定义检测模型和SAM模型的路径 7 | det_model_pt="ADE20K_detect/Javeri_detect_0.993/weights/best.pt" 8 | output_labels_path = "../datasets/Javeri_det_seg/valid_detect_train/labels" 9 | 10 | # det_model_pt="ADE20K_detect/Javeri_detect+10%_0.954/weights/best.pt" 11 | # output_labels_path = "../datasets/Javeri_det_seg/valid_detect_train+10%/labels" 12 | 13 | # det_model_pt="ADE20K_detect/Javeri_detect+20%_0.959/weights/best.pt" 14 | # output_labels_path = "../datasets/Javeri_det_seg/valid_detect_train+20%/labels" 15 | 16 | # det_model_pt="ADE20K_detect/Javeri_detect+50%_0.989/weights/best.pt" 17 | # output_labels_path = "../datasets/Javeri_det_seg/valid_detect_train+50%/labels" 18 | # 根据CUDA是否可用选择设备 19 | device = '0' if torch.cuda.is_available() else 'cpu' 20 | 21 | img_str = '../datasets/Javeri_det_seg/valid_detect/images/' 22 | # 获取图像数据路径 23 | img_path = Path(img_str) 24 | 25 | 26 | # 初始化检测模型和SAM模型 27 | det_model = YOLO(det_model_pt) 28 | 29 | 30 | 31 | 32 | 33 | Path(output_labels_path).mkdir(exist_ok=True, parents=True) 34 | 35 | # 对图像数据进行检测 36 | det_results = det_model(img_path, stream=True, device=device) 37 | print("yes") 38 | 39 | for result in det_results: 40 | # 获取类别ID 41 | class_ids = result.boxes.cls.int().tolist() # noqa 42 | # 如果有检测到物体 43 | if len(class_ids): 44 | # 获取检测框坐标 45 | boxes = result.boxes.xywhn # Boxes object for bbox outputs #torch.Size([6, 4]) 46 | 47 | with open(f"{Path(output_labels_path) / Path(result.path).stem}.txt", "w") as f: 48 | for i in range(len(boxes)): 49 | s = boxes[i] 50 | # 如果分割区域为空,则跳过 51 | if len(s) == 0: 52 | continue 53 | # 将分割区域坐标转换为字符串格式 54 | boxes_i = map(str, boxes[i].reshape(-1).tolist()) 55 | # 写入标注信息 56 | f.write(f"{class_ids[i]} " + " ".join(boxes_i) + "\n") -------------------------------------------------------------------------------- /scripts/utile/12_yolo2seglabels.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | from ultralytics import SAM, YOLO 3 | import torch 4 | 5 | 6 | # # 定义检测模型和SAM模型的路径 7 | # seg_model_pt="result/Comparative_experiment_exp/yolov9t-seg_0.849/weights/last.pt" 8 | # output_labels_path = "./result/13/yolov9tlabels" 9 | 10 | # seg_model_pt="result/Comparative_experiment_exp/yolov8-seg-p6_0.851/weights/last.pt" 11 | # output_labels_path = "./result/13/yolov8p6labels" 12 | 13 | # seg_model_pt="result/Comparative_experiment_exp/yolov6-seg_0.858/weights/last.pt" 14 | # output_labels_path = "./result/13/yolov6labels" 15 | 16 | # seg_model_pt="result/Comparative_experiment_exp/yolov8-seg-ghost_0.849/weights/last.pt" 17 | # output_labels_path = "./result/13/yolov8ghostlabels" 18 | 19 | seg_model_pt="result/Ablation_experiment_exp/ALSSn-seg-24-MSCAMv3_0.857/weights/last.pt" 20 | output_labels_path = "./result/13/ALSSnlabels" 21 | 22 | 23 | 24 | # 根据CUDA是否可用选择设备 25 | device = '0' if torch.cuda.is_available() else 'cpu' 26 | 27 | img_str = 'result/13' 28 | # 获取图像数据路径 29 | img_path = Path(img_str) 30 | 31 | 32 | # 初始化检测模型和SAM模型 33 | seg_model = YOLO(seg_model_pt) 34 | 35 | 36 | 37 | 38 | 39 | Path(output_labels_path).mkdir(exist_ok=True, parents=True) 40 | 41 | # 对图像数据进行检测 42 | seg_results = seg_model(img_path, stream=True, device=device) 43 | print("yes") 44 | 45 | for result in seg_results: 46 | # 获取类别ID 47 | class_ids = result.boxes.cls.int().tolist() # noqa 48 | # 如果有检测到物体 49 | if len(class_ids): 50 | # 获取检测框坐标 51 | masks = result.masks.xyn # Boxes object for bbox outputs #torch.Size([6, 4]) 52 | 53 | with open(f"{Path(output_labels_path) / Path(result.path).stem}.txt", "w") as f: 54 | for i in range(len(masks)): 55 | s = masks[i] 56 | # 如果分割区域为空,则跳过 57 | if len(s) == 0: 58 | continue 59 | # 将分割区域坐标转换为字符串格式 60 | masks_i = map(str, masks[i].reshape(-1).tolist()) 61 | # 写入标注信息 62 | f.write(f"{class_ids[i]} " + " ".join(masks_i) + "\n") -------------------------------------------------------------------------------- /scripts/utile/14_自带数据转换.py: -------------------------------------------------------------------------------- 1 | # from ultralytics.data.converter import convert_coco 2 | 3 | # convert_coco("../datasets/coco1/", use_segments=True, use_keypoints=False, cls91to80=False) 4 | 5 | 6 | from ultralytics.data.converter import convert_segment_masks_to_yolo_seg 7 | 8 | # The classes here is the total classes in the dataset, for COCO dataset we have 80 classes 9 | convert_segment_masks_to_yolo_seg("/media/ang/2T/datasets/未处理的数据集/ADE20K_2016/annotations/train", "./ADE20K_2016/", classes=150) -------------------------------------------------------------------------------- /scripts/utile/1_pix.py: -------------------------------------------------------------------------------- 1 | from PIL import Image 2 | 3 | def resize_image(input_path, output_path, size=(640, 640)): 4 | with Image.open(input_path) as img: 5 | resized_img = img.resize(size, Image.LANCZOS) 6 | resized_img.save(output_path) 7 | 8 | if __name__ == "__main__": 9 | input_image_path = 'ultralytics/assets/zidane.jpg' 10 | output_image_path = 'ultralytics/assets/zidane_640.jpg' 11 | 12 | resize_image(input_image_path, output_image_path) 13 | print(f"Image resized and saved to {output_image_path}") 14 | -------------------------------------------------------------------------------- /scripts/utile/2_load_model.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | # 定义模型路径 4 | model_path = 'yolov8n.pt' 5 | 6 | # 加载模型 7 | model = torch.load(model_path, map_location=torch.device('cpu')) 8 | 9 | # 即便官方模型的许多参数都用不了 10 | # 打印模型的键 11 | if isinstance(model, dict): 12 | print("Model keys:", model.keys()) 13 | else: 14 | print("Loaded object is not a dictionary. It might be a model object.") 15 | 16 | 17 | # 时间 版本 开源协议 文档 当前训练轮次 最好拟合值 模型 ema update 优化器 训练参数(这里改了好多) 训练指标(最后的) 训练结果(每次的) 18 | # ['date', 'version', 'license', 'docs', 'epoch', 'best_fitness', 'model', 'ema', 'updates', 'optimizer', 'train_args', 'train_metrics', 'train_results'] -------------------------------------------------------------------------------- /scripts/utile/4_generate_segmentation_labels.py: -------------------------------------------------------------------------------- 1 | from ultralytics import SAM 2 | 3 | # Load a model 4 | model = SAM("sam_b.pt") 5 | 6 | # Segment with bounding box prompt 7 | sam_results = model("ultralytics/assets/zidane.jpg") 8 | 9 | # Segment with points prompt 10 | # model("ultralytics/assets/zidane.jpg", points=[900, 370], labels=[1]) 11 | 12 | output_path = './1.txt' 13 | segments = sam_results[0].masks.xyn # noqa 14 | # 为每个图像生成标注文件 15 | with open(output_path, "w") as f: 16 | # 增量ID初始化 17 | incremental_id = 0 18 | # 遍历每个分割区域 19 | for i in range(len(segments)): 20 | s = segments[i] 21 | # 如果分割区域为空,则跳过 22 | if len(s) == 0: 23 | continue 24 | # 将分割区域坐标转换为字符串格式 25 | segment = map(str, segments[i].reshape(-1).tolist()) 26 | # 写入标注信息,使用增量ID 27 | f.write(f"{incremental_id} " + " ".join(segment) + "\n") 28 | # 增量ID递增 29 | incremental_id += 1 30 | -------------------------------------------------------------------------------- /scripts/utile/5_yolo_sam_auto_annotate.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | from ultralytics import SAM, YOLO 3 | import torch 4 | 5 | # 定义图像数据路径 6 | img_str = 'ultralytics/assets' 7 | 8 | # 定义检测模型和SAM模型的路径 9 | det_model_pt="yolov8n.pt" 10 | sam_model_pt="sam_b.pt" 11 | 12 | # 根据CUDA是否可用选择设备 13 | device = '0' if torch.cuda.is_available() else 'cpu' 14 | 15 | # 定义输出目录,默认为None 16 | # 输出路径 17 | output_path = None 18 | 19 | # 初始化检测模型和SAM模型 20 | det_model = YOLO(det_model_pt) 21 | sam_model = SAM(sam_model_pt) 22 | 23 | # 获取图像数据路径 24 | img_path = Path(img_str) 25 | 26 | # 如果输出目录未定义,则生成默认的输出目录 27 | if not output_path: 28 | output_path = img_path.parent / f"{img_path.stem}_auto_annotate_labels" 29 | # 创建输出目录 30 | Path(output_path).mkdir(exist_ok=True, parents=True) 31 | 32 | # 对图像数据进行检测 33 | det_results = det_model(img_path, stream=True, device=device) 34 | 35 | # 遍历检测结果 36 | for result in det_results: 37 | # 获取类别ID 38 | class_ids = result.boxes.cls.int().tolist() # noqa 39 | # 如果有检测到物体 40 | if len(class_ids): 41 | # 获取检测框坐标 42 | boxes = result.boxes.xyxy # Boxes object for bbox outputs #torch.Size([6, 4]) 43 | # 使用SAM模型进行分割 44 | sam_results = sam_model(result.orig_img, bboxes=boxes, verbose=False, save=False, device=device) 45 | # 获取分割结果 46 | segments = sam_results[0].masks.xyn # noqa 47 | # 为每个图像生成标注文件 48 | with open(f"{Path(output_path) / Path(result.path).stem}.txt", "w") as f: 49 | # 遍历每个分割区域 50 | for i in range(len(segments)): 51 | s = segments[i] 52 | # 如果分割区域为空,则跳过 53 | if len(s) == 0: 54 | continue 55 | # 将分割区域坐标转换为字符串格式 56 | segment = map(str, segments[i].reshape(-1).tolist()) 57 | # 写入标注信息 58 | f.write(f"{class_ids[i]} " + " ".join(segment) + "\n") 59 | -------------------------------------------------------------------------------- /scripts/utile/free_cuda.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import subprocess 3 | 4 | def get_free_gpu(start_index=1): 5 | # 使用nvidia-smi命令获取GPU利用率信息 6 | result = subprocess.check_output(["nvidia-smi", "--query-gpu=utilization.gpu", "--format=csv,noheader,nounits"]) 7 | gpu_usages = result.decode("utf-8").strip().split("\n") 8 | 9 | # 从指定的起始索引开始查找完全空闲的GPU 10 | num_gpus = len(gpu_usages) 11 | for i in range(start_index, num_gpus): 12 | if int(gpu_usages[i]) == 0: 13 | return i 14 | 15 | # 如果没有找到空闲的GPU,从头开始查找 16 | for i in range(start_index): 17 | if int(gpu_usages[i]) == 0: 18 | return i 19 | 20 | return '0' 21 | 22 | gpu_id = get_free_gpu(start_index=1) 23 | if gpu_id is not None: 24 | device = torch.device(f"cuda:{gpu_id}") 25 | print(f"Using GPU: cuda:{gpu_id}") 26 | else: 27 | device = torch.device("cpu") 28 | print("No free GPU found, using CPU") 29 | 30 | 31 | # 初始化根据语义写成几个内部的成员函数,使其简洁明了,但不改变整体逻辑 -------------------------------------------------------------------------------- /scripts/utile/mota.py: -------------------------------------------------------------------------------- 1 | 2 | # from modelscope.hub.api import HubApi 3 | # YOUR_ACCESS_TOKEN = 'e00292e3-3e13-4bde-9ff1-40d15c74f9d2' 4 | # api = HubApi() 5 | # api.login(YOUR_ACCESS_TOKEN) 6 | 7 | # from modelscope.hub.constants import Licenses, ModelVisibility 8 | 9 | # username = 'helloworlder8' 10 | # model_name = 'ALSS-YOLO-Seg' 11 | 12 | # api.create_model( 13 | # model_id=f"{username}/{model_name}", 14 | # visibility=ModelVisibility.PUBLIC, 15 | # license=Licenses.APACHE_V2, 16 | # chinese_name="", 17 | # ) 18 | 19 | from modelscope.hub.api import HubApi 20 | 21 | YOUR_ACCESS_TOKEN = 'e00292e3-3e13-4bde-9ff1-40d15c74f9d2' 22 | 23 | api = HubApi() 24 | api.login(YOUR_ACCESS_TOKEN) 25 | 26 | # 上传模型 27 | api.push_model( 28 | model_id="helloworlder8/ALSS-YOLO-Seg", # 如果model_id对应的模型库不存在,将会自动创建 29 | model_dir="./" # 指定本地模型目录,目录中必须包含configuration.json文件 30 | ) -------------------------------------------------------------------------------- /scripts/utile/send_notice.py: -------------------------------------------------------------------------------- 1 | import requests 2 | def send_notice(content): 3 | token = "853672d072e640479144fba8b29b314b" 4 | title = "训练成功" 5 | url = f"http://www.pushplus.plus/send?token={token}&title={title}&content={content}&template=html" 6 | response = requests.request("GET", url) 7 | print(response.text) 8 | 9 | 10 | def send_notice_by_task(metrics,task): 11 | if task == "detect": 12 | 13 | send_notice(f"metrics/mAP50(B): {metrics.results_dict['metrics/mAP50(B)']}, " 14 | f"metrics/mAP50-95(B): {metrics.results_dict['metrics/mAP50-95(B)']}, " 15 | # f"mAP50(B): {metrics.results_dict['metrics/mAP50(M)']}, " 16 | # f"mAP50-95(B): {metrics.results_dict['metrics/mAP50-95(M)']}, " 17 | f"Fitness: {metrics.results_dict['fitness']}") 18 | elif task == "segment": 19 | send_notice(f"metrics/mAP50(B): {metrics.results_dict['metrics/mAP50(B)']}, " 20 | f"metrics/mAP50-95(B): {metrics.results_dict['metrics/mAP50-95(B)']}, " 21 | f"metrics/mAP50(M): {metrics.results_dict['metrics/mAP50(M)']}, " 22 | f"metrics/mAP50-95(M): {metrics.results_dict['metrics/mAP50-95(M)']}, " 23 | f"Fitness: {metrics.results_dict['fitness']}") 24 | else: 25 | send_notice("yes") -------------------------------------------------------------------------------- /scripts/utile/文件行数.py: -------------------------------------------------------------------------------- 1 | file_path = 'ADE20K_2016_yolo/valid_segment/MMB/sam_l_labels/1_iou_results.txt' 2 | 3 | # 统计文件总行数 4 | with open(file_path, 'r') as file: 5 | total_lines = len(file.readlines()) 6 | 7 | print(f"Total number of lines: {total_lines}") 8 | -------------------------------------------------------------------------------- /scripts/utile/测试cuda是否可用.py: -------------------------------------------------------------------------------- 1 | import torch 2 | 3 | def check_cuda_availability(): 4 | if torch.cuda.is_available(): 5 | print("CUDA is available. You can use GPU for computations.") 6 | print(f"Number of available GPUs: {torch.cuda.device_count()}") 7 | for i in range(torch.cuda.device_count()): 8 | print(f"GPU {i}: {torch.cuda.get_device_name(i)}") 9 | else: 10 | print("CUDA is not available. You will be using CPU for computations.") 11 | 12 | if __name__ == "__main__": 13 | check_cuda_availability() 14 | -------------------------------------------------------------------------------- /scripts/utile/转换.py: -------------------------------------------------------------------------------- 1 | from ultralytics import YOLO 2 | 3 | # Load a model 4 | model = YOLO("yolov8s-seg.pt") # load an official model 5 | # model = YOLO("path/to/best.pt") # load a custom trained model 6 | 7 | # Export the model 8 | model.export(format="ncnn") -------------------------------------------------------------------------------- /tar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 获取当前年份、月份和日期 4 | current_date=$(date +%Y-%m-%d) 5 | 6 | # 归档文件的路径和名称,包括年份、月份和日期 7 | archive_file="../computer_vision-$current_date.tar.gz" 8 | 9 | # 要归档的目录 10 | source_directory="../computer_vision-11-14" 11 | 12 | # 使用 tar 命令创建归档文件,同时排除 .pt 文件、checkpoints 和 runs 目录 13 | tar --exclude="*.pt" --exclude="$source_directory/runs" --exclude="$source_directory/datasets" -czvf "$archive_file" -C "$source_directory" . 14 | 15 | echo "Archive created: $archive_file" 16 | 17 | 18 | # alss v8-ghost v6 v8-p6 v8t -------------------------------------------------------------------------------- /train.sh: -------------------------------------------------------------------------------- 1 | # python scripts/train/train2.py; 2 | # python scripts/utile/0_box_point_SAM.py 3 | python scripts/train/train1.py; 4 | # python scripts/train/train2.py; 5 | # python scripts/train/train3.py; 6 | # python scripts/train/train4.py; 7 | # python scripts/train/train5.py; 8 | # python scripts/train/train6.py; 9 | # python scripts/train/train7.py; 10 | # python scripts/train/train8.py; 11 | # export PYTHONPATH=$PYTHONPATH:/home/gcsx/ANG/ultralytics 12 | 13 | 14 | # screen -S test 15 | # screen -ls 16 | # 关闭 ctrl+a+d 17 | # 重新打开 screen -r 3342653.test 18 | # screen -X -S 1483397.test quit -------------------------------------------------------------------------------- /ultralytics.egg-info/dependency_links.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ultralytics.egg-info/entry_points.txt: -------------------------------------------------------------------------------- 1 | [console_scripts] 2 | ultralytics = ultralytics.cfg_yaml:entrypoint 3 | yolo = ultralytics.cfg_yaml:entrypoint 4 | -------------------------------------------------------------------------------- /ultralytics.egg-info/requires.txt: -------------------------------------------------------------------------------- 1 | numpy<2.0.0,>=1.23.0 2 | matplotlib>=3.3.0 3 | opencv-python>=4.6.0 4 | pillow>=7.1.2 5 | pyyaml>=5.3.1 6 | requests>=2.23.0 7 | scipy>=1.4.1 8 | torch>=1.8.0 9 | torchvision>=0.9.0 10 | tqdm>=4.64.0 11 | psutil 12 | py-cpuinfo 13 | pandas>=1.1.4 14 | seaborn>=0.11.0 15 | ultralytics-thop>=2.0.0 16 | 17 | [dev] 18 | ipython 19 | pytest 20 | pytest-cov 21 | coverage[toml] 22 | mkdocs>=1.6.0 23 | mkdocs-material>=9.5.9 24 | mkdocstrings[python] 25 | mkdocs-jupyter 26 | mkdocs-redirects 27 | mkdocs-ultralytics-plugin>=0.0.49 28 | 29 | [explorer] 30 | lancedb 31 | duckdb<=0.9.2 32 | streamlit 33 | 34 | [export] 35 | onnx>=1.12.0 36 | openvino>=2024.0.0 37 | tensorflow>=2.0.0 38 | tensorflowjs>=3.9.0 39 | keras 40 | 41 | [export:platform_machine == "aarch64"] 42 | flatbuffers<100,>=23.5.26 43 | numpy==1.23.5 44 | h5py!=3.11.0 45 | 46 | [export:platform_system != "Windows" and python_version <= "3.11"] 47 | coremltools>=7.0 48 | 49 | [extra] 50 | hub-sdk>=0.0.8 51 | ipython 52 | albumentations>=1.4.6 53 | pycocotools>=2.0.7 54 | 55 | [logging] 56 | comet 57 | tensorboard>=2.13.0 58 | dvclive>=2.12.0 59 | -------------------------------------------------------------------------------- /ultralytics.egg-info/top_level.txt: -------------------------------------------------------------------------------- 1 | ultralytics 2 | -------------------------------------------------------------------------------- /ultralytics/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | __version__ = "8.2.60" 4 | 5 | import os 6 | 7 | # Set ENV Variables (place before imports) 8 | os.environ["OMP_NUM_THREADS"] = "1" # reduce CPU utilization during training 9 | 10 | from ultralytics.data.explorer.explorer import Explorer 11 | from ultralytics.models import NAS, RTDETR, SAM, YOLO, FastSAM, YOLOWorld 12 | from ultralytics.utils import ASSETS, SETTINGS 13 | from ultralytics.utils.checks import check_yolo as checks 14 | from ultralytics.utils.downloads import download 15 | 16 | settings = SETTINGS 17 | __all__ = ( 18 | "__version__", 19 | "ASSETS", 20 | "YOLO", 21 | "YOLOWorld", 22 | "NAS", 23 | "SAM", 24 | "FastSAM", 25 | "RTDETR", 26 | "checks", 27 | "download", 28 | "settings", 29 | "Explorer", 30 | ) 31 | -------------------------------------------------------------------------------- /ultralytics/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/assets/bus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/assets/bus.jpg -------------------------------------------------------------------------------- /ultralytics/assets/zidane.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/assets/zidane.jpg -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/cfg_yaml/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/datasets/DOTAv1.5.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license 2 | 3 | # DOTA 1.5 dataset https://captain-whu.github.io/DOTA/index.html for object detection in aerial images by Wuhan University 4 | # Documentation: https://docs.ultralytics.com/datasets/obb/dota-v2/ 5 | # Example usage: yolo train model=yolov8n-obb.pt data=DOTAv1.5.yaml 6 | # parent 7 | # ├── ultralytics 8 | # └── datasets 9 | # └── dota1.5 ← downloads here (2GB) 10 | 11 | # 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, ..] 12 | path: ../datasets/DOTAv1.5 # dataset root dir 13 | train: images/train # train images (relative to 'path') 1411 images 14 | val: images/val # val images (relative to 'path') 458 images 15 | test: images/test # test images (optional) 937 images 16 | 17 | # Classes for DOTA 1.5 18 | names: 19 | 0: plane 20 | 1: ship 21 | 2: storage tank 22 | 3: baseball diamond 23 | 4: tennis court 24 | 5: basketball court 25 | 6: ground track field 26 | 7: harbor 27 | 8: bridge 28 | 9: large vehicle 29 | 10: small vehicle 30 | 11: helicopter 31 | 12: roundabout 32 | 13: soccer ball field 33 | 14: swimming pool 34 | 15: container crane 35 | 36 | # Download script/URL (optional) 37 | download: https://github.com/ultralytics/assets/releases/download/v0.0.0/DOTAv1.5.zip 38 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/datasets/DOTAv1.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license 2 | 3 | # DOTA 1.0 dataset https://captain-whu.github.io/DOTA/index.html for object detection in aerial images by Wuhan University 4 | # Documentation: https://docs.ultralytics.com/datasets/obb/dota-v2/ 5 | # Example usage: yolo train model=yolov8n-obb.pt data=DOTAv1.yaml 6 | # parent 7 | # ├── ultralytics 8 | # └── datasets 9 | # └── dota1 ← downloads here (2GB) 10 | 11 | # 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, ..] 12 | path: ../datasets/DOTAv1 # dataset root dir 13 | train: images/train # train images (relative to 'path') 1411 images 14 | val: images/val # val images (relative to 'path') 458 images 15 | test: images/test # test images (optional) 937 images 16 | 17 | # Classes for DOTA 1.0 18 | names: 19 | 0: plane 20 | 1: ship 21 | 2: storage tank 22 | 3: baseball diamond 23 | 4: tennis court 24 | 5: basketball court 25 | 6: ground track field 26 | 7: harbor 27 | 8: bridge 28 | 9: large vehicle 29 | 10: small vehicle 30 | 11: helicopter 31 | 12: roundabout 32 | 13: soccer ball field 33 | 14: swimming pool 34 | 35 | # Download script/URL (optional) 36 | download: https://github.com/ultralytics/assets/releases/download/v0.0.0/DOTAv1.zip 37 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/datasets/african-wildlife.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license 2 | 3 | # African-wildlife dataset by Ultralytics 4 | # Documentation: https://docs.ultralytics.com/datasets/detect/african-wildlife/ 5 | # Example usage: yolo train data=african-wildlife.yaml 6 | # parent 7 | # ├── ultralytics 8 | # └── datasets 9 | # └── african-wildlife ← downloads here (100 MB) 10 | 11 | # 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, ..] 12 | path: ../datasets/african-wildlife # dataset root dir 13 | train: train/images # train images (relative to 'path') 1052 images 14 | val: valid/images # val images (relative to 'path') 225 images 15 | test: test/images # test images (relative to 'path') 227 images 16 | 17 | # Classes 18 | names: 19 | 0: buffalo 20 | 1: elephant 21 | 2: rhino 22 | 3: zebra 23 | 24 | # Download script/URL (optional) 25 | download: https://github.com/ultralytics/assets/releases/download/v0.0.0/african-wildlife.zip 26 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/datasets/brain-tumor.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license 2 | 3 | # Brain-tumor dataset by Ultralytics 4 | # Documentation: https://docs.ultralytics.com/datasets/detect/brain-tumor/ 5 | # Example usage: yolo train data=brain-tumor.yaml 6 | # parent 7 | # ├── ultralytics 8 | # └── datasets 9 | # └── brain-tumor ← downloads here (4.05 MB) 10 | 11 | # 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, ..] 12 | path: ../datasets/brain-tumor # dataset root dir 13 | train: train/images # train images (relative to 'path') 893 images 14 | val: valid/images # val images (relative to 'path') 223 images 15 | test: # test images (relative to 'path') 16 | 17 | # Classes 18 | names: 19 | 0: negative 20 | 1: positive 21 | 22 | # Download script/URL (optional) 23 | download: https://github.com/ultralytics/assets/releases/download/v0.0.0/brain-tumor.zip 24 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/datasets/carparts-seg.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license 2 | 3 | # Carparts-seg dataset by Ultralytics 4 | # Documentation: https://docs.ultralytics.com/datasets/segment/carparts-seg/ 5 | # Example usage: yolo train data=carparts-seg.yaml 6 | # parent 7 | # ├── ultralytics 8 | # └── datasets 9 | # └── carparts-seg ← downloads here (132 MB) 10 | 11 | # 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, ..] 12 | path: ../datasets/carparts-seg # dataset root dir 13 | train: train/images # train images (relative to 'path') 3516 images 14 | val: valid/images # val images (relative to 'path') 276 images 15 | test: test/images # test images (relative to 'path') 401 images 16 | 17 | # Classes 18 | names: 19 | 0: back_bumper 20 | 1: back_door 21 | 2: back_glass 22 | 3: back_left_door 23 | 4: back_left_light 24 | 5: back_light 25 | 6: back_right_door 26 | 7: back_right_light 27 | 8: front_bumper 28 | 9: front_door 29 | 10: front_glass 30 | 11: front_left_door 31 | 12: front_left_light 32 | 13: front_light 33 | 14: front_right_door 34 | 15: front_right_light 35 | 16: hood 36 | 17: left_mirror 37 | 18: object 38 | 19: right_mirror 39 | 20: tailgate 40 | 21: trunk 41 | 22: wheel 42 | 43 | # Download script/URL (optional) 44 | download: https://github.com/ultralytics/assets/releases/download/v0.0.0/carparts-seg.zip 45 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/datasets/coco-pose.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license 2 | 3 | # COCO 2017 Keypoints dataset https://cocodataset.org by Microsoft 4 | # Documentation: https://docs.ultralytics.com/datasets/pose/coco/ 5 | # Example usage: yolo train data=coco-pose.yaml 6 | # parent 7 | # ├── ultralytics 8 | # └── datasets 9 | # └── coco-pose ← downloads here (20.1 GB) 10 | 11 | # 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, ..] 12 | path: ../datasets/coco-pose # dataset root dir 13 | train: train2017.txt # train images (relative to 'path') 56599 images 14 | val: val2017.txt # val images (relative to 'path') 2346 images 15 | test: test-dev2017.txt # 20288 of 40670 images, submit to https://codalab.lisn.upsaclay.fr/competitions/7403 16 | 17 | # Keypoints 18 | kpt_shape: [17, 3] # number of keypoints, number of dims (2 for x,y or 3 for x,y,visible) 19 | flip_idx: [0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15] 20 | 21 | # Classes 22 | names: 23 | 0: person 24 | 25 | # Download script/URL (optional) 26 | download: | 27 | from ultralytics.utils.downloads import download 28 | from pathlib import Path 29 | 30 | # Download labels 31 | dir = Path(yaml['path']) # dataset root dir 32 | url = 'https://github.com/ultralytics/assets/releases/download/v0.0.0/' 33 | urls = [url + 'coco2017labels-pose.zip'] # labels 34 | download(urls, dir=dir.parent) 35 | # Download data 36 | urls = ['http://images.cocodataset.org/zips/train2017.zip', # 19G, 118k images 37 | 'http://images.cocodataset.org/zips/val2017.zip', # 1G, 5k images 38 | 'http://images.cocodataset.org/zips/test2017.zip'] # 7G, 41k images (optional) 39 | download(urls, dir=dir / 'images', threads=3) 40 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/datasets/coco8-pose.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license 2 | 3 | # COCO8-pose dataset (first 8 images from COCO train2017) by Ultralytics 4 | # Documentation: https://docs.ultralytics.com/datasets/pose/coco8-pose/ 5 | # Example usage: yolo train data=coco8-pose.yaml 6 | # parent 7 | # ├── ultralytics 8 | # └── datasets 9 | # └── coco8-pose ← downloads here (1 MB) 10 | 11 | # 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, ..] 12 | path: ../datasets/coco8-pose # dataset root dir 13 | train: images/train # train images (relative to 'path') 4 images 14 | val: images/val # val images (relative to 'path') 4 images 15 | test: # test images (optional) 16 | 17 | # Keypoints 18 | kpt_shape: [17, 3] # number of keypoints, number of dims (2 for x,y or 3 for x,y,visible) 19 | flip_idx: [0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15] 20 | 21 | # Classes 22 | names: 23 | 0: person 24 | 25 | # Download script/URL (optional) 26 | download: https://github.com/ultralytics/assets/releases/download/v0.0.0/coco8-pose.zip 27 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/datasets/crack-seg.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license 2 | 3 | # Crack-seg dataset by Ultralytics 4 | # Documentation: https://docs.ultralytics.com/datasets/segment/crack-seg/ 5 | # Example usage: yolo train data=crack-seg.yaml 6 | # parent 7 | # ├── ultralytics 8 | # └── datasets 9 | # └── crack-seg ← downloads here (91.2 MB) 10 | 11 | # 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, ..] 12 | path: ../datasets/crack-seg # dataset root dir 13 | train: train/images # train images (relative to 'path') 3717 images 14 | val: valid/images # val images (relative to 'path') 112 images 15 | test: test/images # test images (relative to 'path') 200 images 16 | 17 | # Classes 18 | names: 19 | 0: crack 20 | 21 | # Download script/URL (optional) 22 | download: https://github.com/ultralytics/assets/releases/download/v0.0.0/crack-seg.zip 23 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/datasets/dog-pose.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license 2 | 3 | # Dogs dataset http://vision.stanford.edu/aditya86/ImageNetDogs/ by Stanford 4 | # Documentation: https://docs.ultralytics.com/datasets/pose/dog-pose/ 5 | # Example usage: yolo train data=dog-pose.yaml 6 | # parent 7 | # ├── ultralytics 8 | # └── datasets 9 | # └── dog-pose ← downloads here (337 MB) 10 | 11 | # 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, ..] 12 | path: ../datasets/dog-pose # dataset root dir 13 | train: train # train images (relative to 'path') 6773 images 14 | val: val # val images (relative to 'path') 1703 images 15 | 16 | # Keypoints 17 | kpt_shape: [24, 3] # number of keypoints, number of dims (2 for x,y or 3 for x,y,visible) 18 | 19 | # Classes 20 | names: 21 | 0: dog 22 | 23 | # Download script/URL (optional) 24 | download: https://github.com/ultralytics/assets/releases/download/v0.0.0/dog-pose.zip 25 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/datasets/dota8.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license 2 | 3 | # DOTA8 dataset 8 images from split DOTAv1 dataset by Ultralytics 4 | # Documentation: https://docs.ultralytics.com/datasets/obb/dota8/ 5 | # Example usage: yolo train model=yolov8n-obb.pt data=dota8.yaml 6 | # parent 7 | # ├── ultralytics 8 | # └── datasets 9 | # └── dota8 ← downloads here (1MB) 10 | 11 | # 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, ..] 12 | path: ../datasets/dota8 # dataset root dir 13 | train: images/train # train images (relative to 'path') 4 images 14 | val: images/val # val images (relative to 'path') 4 images 15 | 16 | # Classes for DOTA 1.0 17 | names: 18 | 0: plane 19 | 1: ship 20 | 2: storage tank 21 | 3: baseball diamond 22 | 4: tennis court 23 | 5: basketball court 24 | 6: ground track field 25 | 7: harbor 26 | 8: bridge 27 | 9: large vehicle 28 | 10: small vehicle 29 | 11: helicopter 30 | 12: roundabout 31 | 13: soccer ball field 32 | 14: swimming pool 33 | 34 | # Download script/URL (optional) 35 | download: https://github.com/ultralytics/assets/releases/download/v0.0.0/dota8.zip 36 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/datasets/hand-keypoints.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license 2 | 3 | # Hand Keypoints dataset by Ultralytics 4 | # Documentation: https://docs.ultralytics.com/datasets/pose/hand-keypoints/ 5 | # Example usage: yolo train data=hand-keypoints.yaml 6 | # parent 7 | # ├── ultralytics 8 | # └── datasets 9 | # └── hand-keypoints ← downloads here (369 MB) 10 | 11 | # 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, ..] 12 | path: ../datasets/hand-keypoints # dataset root dir 13 | train: train # train images (relative to 'path') 18776 images 14 | val: val # val images (relative to 'path') 7992 images 15 | 16 | # Keypoints 17 | kpt_shape: [21, 3] # number of keypoints, number of dims (2 for x,y or 3 for x,y,visible) 18 | flip_idx: 19 | [0, 1, 2, 4, 3, 10, 11, 12, 13, 14, 5, 6, 7, 8, 9, 15, 16, 17, 18, 19, 20] 20 | 21 | # Classes 22 | names: 23 | 0: hand 24 | 25 | # Download script/URL (optional) 26 | download: https://github.com/ultralytics/assets/releases/download/v0.0.0/hand-keypoints.zip 27 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/datasets/medical-pills.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license 2 | 3 | # Medical-pills dataset by Ultralytics 4 | # Documentation: https://docs.ultralytics.com/datasets/detect/medical-pills/ 5 | # Example usage: yolo train data=medical-pills.yaml 6 | # parent 7 | # ├── ultralytics 8 | # └── datasets 9 | # └── medical-pills ← downloads here (8.19 MB) 10 | 11 | # 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, ..] 12 | path: ../datasets/medical-pills # dataset root dir 13 | train: train/images # train images (relative to 'path') 92 images 14 | val: valid/images # val images (relative to 'path') 23 images 15 | test: # test images (relative to 'path') 16 | 17 | # Classes 18 | names: 19 | 0: pill 20 | 21 | # Download script/URL (optional) 22 | download: https://github.com/ultralytics/assets/releases/download/v0.0.0/medical-pills.zip 23 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/datasets/package-seg.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license 2 | 3 | # Package-seg dataset by Ultralytics 4 | # Documentation: https://docs.ultralytics.com/datasets/segment/package-seg/ 5 | # Example usage: yolo train data=package-seg.yaml 6 | # parent 7 | # ├── ultralytics 8 | # └── datasets 9 | # └── package-seg ← downloads here (102 MB) 10 | 11 | # 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, ..] 12 | path: ../datasets/package-seg # dataset root dir 13 | train: train/images # train images (relative to 'path') 1920 images 14 | val: valid/images # val images (relative to 'path') 89 images 15 | test: test/images # test images (relative to 'path') 188 images 16 | 17 | # Classes 18 | names: 19 | 0: package 20 | 21 | # Download script/URL (optional) 22 | download: https://github.com/ultralytics/assets/releases/download/v0.0.0/package-seg.zip 23 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/datasets/signature.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license 2 | 3 | # Signature dataset by Ultralytics 4 | # Documentation: https://docs.ultralytics.com/datasets/detect/signature/ 5 | # Example usage: yolo train data=signature.yaml 6 | # parent 7 | # ├── ultralytics 8 | # └── datasets 9 | # └── signature ← downloads here (11.2 MB) 10 | 11 | # 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, ..] 12 | path: ../datasets/signature # dataset root dir 13 | train: train/images # train images (relative to 'path') 143 images 14 | val: valid/images # val images (relative to 'path') 35 images 15 | 16 | # Classes 17 | names: 18 | 0: signature 19 | 20 | # Download script/URL (optional) 21 | download: https://github.com/ultralytics/assets/releases/download/v0.0.0/signature.zip 22 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/datasets/tiger-pose.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license 2 | 3 | # Tiger Pose dataset by Ultralytics 4 | # Documentation: https://docs.ultralytics.com/datasets/pose/tiger-pose/ 5 | # Example usage: yolo train data=tiger-pose.yaml 6 | # parent 7 | # ├── ultralytics 8 | # └── datasets 9 | # └── tiger-pose ← downloads here (75.3 MB) 10 | 11 | # 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, ..] 12 | path: ../datasets/tiger-pose # dataset root dir 13 | train: train # train images (relative to 'path') 210 images 14 | val: val # val images (relative to 'path') 53 images 15 | 16 | # Keypoints 17 | kpt_shape: [12, 2] # number of keypoints, number of dims (2 for x,y or 3 for x,y,visible) 18 | flip_idx: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] 19 | 20 | # Classes 21 | names: 22 | 0: tiger 23 | 24 | # Download script/URL (optional) 25 | download: https://github.com/ultralytics/assets/releases/download/v0.0.0/tiger-pose.zip 26 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/11/yolo11-cls.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLO11-cls image classification model. For Usage examples see https://docs.ultralytics.com/tasks/classify 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolo11n-cls.yaml' will call yolo11-cls.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | n: [0.50, 0.25, 1024] # summary: 151 layers, 1633584 parameters, 1633584 gradients, 3.3 GFLOPs 9 | s: [0.50, 0.50, 1024] # summary: 151 layers, 5545488 parameters, 5545488 gradients, 12.2 GFLOPs 10 | m: [0.50, 1.00, 512] # summary: 187 layers, 10455696 parameters, 10455696 gradients, 39.7 GFLOPs 11 | l: [1.00, 1.00, 512] # summary: 309 layers, 12937104 parameters, 12937104 gradients, 49.9 GFLOPs 12 | x: [1.00, 1.50, 512] # summary: 309 layers, 28458544 parameters, 28458544 gradients, 111.1 GFLOPs 13 | 14 | # YOLO11n backbone 15 | backbone: 16 | # [from, repeats, module, args] 17 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 18 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 19 | - [-1, 2, C3k2, [256, False, 0.25]] 20 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 21 | - [-1, 2, C3k2, [512, False, 0.25]] 22 | - [-1, 1, Conv, [512, 3, 2]] # 5-P4/16 23 | - [-1, 2, C3k2, [512, True]] 24 | - [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32 25 | - [-1, 2, C3k2, [1024, True]] 26 | - [-1, 2, C2PSA, [1024]] # 9 27 | 28 | # YOLO11n head 29 | head: 30 | - [-1, 1, Classify, [nc]] # Classify 31 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/ALSS-YOLO/add_contrast_experiment/yolov8-p2.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv8 object detection model with P2-P5 outputs. For Usage examples see https://docs.ultralytics.com/tasks/detect 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov8n.yaml' will call yolov8.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | n: [0.33, 0.25, 1024] 9 | s: [0.33, 0.50, 1024] 10 | m: [0.67, 0.75, 768] 11 | l: [1.00, 1.00, 512] 12 | x: [1.00, 1.25, 512] 13 | 14 | # YOLOv8.0 backbone 15 | backbone: 16 | # [from, repeats, module, args] 17 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 18 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 19 | - [-1, 3, C2f, [128, True]] 20 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 21 | - [-1, 6, C2f, [256, True]] 22 | - [-1, 1, Conv, [512, 3, 2]] # 5-P4/16 23 | - [-1, 6, C2f, [512, True]] 24 | - [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32 25 | - [-1, 3, C2f, [1024, True]] 26 | - [-1, 1, SPPF, [1024, 5]] # 9 27 | 28 | # YOLOv8.0-p2 head 29 | head: 30 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 31 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 32 | - [-1, 3, C2f, [512]] # 12 33 | 34 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 35 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 36 | - [-1, 3, C2f, [256]] # 15 (P3/8-small) 37 | 38 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 39 | - [[-1, 2], 1, Concat, [1]] # cat backbone P2 40 | - [-1, 3, C2f, [128]] # 18 (P2/4-xsmall) 41 | 42 | - [-1, 1, Conv, [128, 3, 2]] 43 | - [[-1, 15], 1, Concat, [1]] # cat head P3 44 | - [-1, 3, C2f, [256]] # 21 (P3/8-small) 45 | 46 | - [-1, 1, Conv, [256, 3, 2]] 47 | - [[-1, 12], 1, Concat, [1]] # cat head P4 48 | - [-1, 3, C2f, [512]] # 24 (P4/16-medium) 49 | 50 | - [-1, 1, Conv, [512, 3, 2]] 51 | - [[-1, 9], 1, Concat, [1]] # cat head P5 52 | - [-1, 3, C2f, [1024]] # 27 (P5/32-large) 53 | 54 | - [[18, 21, 24, 27], 1, Detect, [nc]] # Detect(P2, P3, P4, P5) 55 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/ALSS-YOLO/add_contrast_experiment/yolov8.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv8 object detection model with P3-P5 outputs. For Usage examples see https://docs.ultralytics.com/tasks/detect 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov8n.yaml' will call yolov8.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | n: [0.33, 0.25, 1024] # YOLOv8n summary: 225 layers, 3157200 parameters, 3157184 gradients, 8.9 GFLOPs 9 | s: [0.33, 0.50, 1024] # YOLOv8s summary: 225 layers, 11166560 parameters, 11166544 gradients, 28.8 GFLOPs 10 | m: [0.67, 0.75, 768] # YOLOv8m summary: 295 layers, 25902640 parameters, 25902624 gradients, 79.3 GFLOPs 11 | l: [1.00, 1.00, 512] # YOLOv8l summary: 365 layers, 43691520 parameters, 43691504 gradients, 165.7 GFLOPs 12 | x: [1.00, 1.25, 512] # YOLOv8x summary: 365 layers, 68229648 parameters, 68229632 gradients, 258.5 GFLOPs 13 | 14 | # YOLOv8.0n backbone 15 | backbone: 16 | # [from, repeats, module, args] 17 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 18 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 19 | - [-1, 3, C2f, [128, True]] 20 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 21 | - [-1, 6, C2f, [256, True]] 22 | - [-1, 1, Conv, [512, 3, 2]] # 5-P4/16 23 | - [-1, 6, C2f, [512, True]] 24 | - [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32 25 | - [-1, 3, C2f, [1024, True]] 26 | - [-1, 1, SPPF, [1024, 5]] # 9 27 | 28 | # YOLOv8.0n head 29 | head: 30 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 31 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 32 | - [-1, 3, C2f, [512]] # 12 33 | 34 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 35 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 36 | - [-1, 3, C2f, [256]] # 15 (P3/8-small) 37 | 38 | - [-1, 1, Conv, [256, 3, 2]] 39 | - [[-1, 12], 1, Concat, [1]] # cat head P4 40 | - [-1, 3, C2f, [512]] # 18 (P4/16-medium) 41 | 42 | - [-1, 1, Conv, [512, 3, 2]] 43 | - [[-1, 9], 1, Concat, [1]] # cat head P5 44 | - [-1, 3, C2f, [1024]] # 21 (P5/32-large) 45 | 46 | - [[15, 18, 21], 1, Detect, [nc]] # Detect(P3, P4, P5) 47 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/rt-detr/rtdetr-resnet101.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # RT-DETR-ResNet101 object detection model with P3-P5 outputs. 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov8n-cls.yaml' will call yolov8-cls.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | l: [1.00, 1.00, 1024] 9 | 10 | backbone: 11 | # [from, repeats, module, args] 12 | - [-1, 1, ResNetLayer, [3, 64, 1, True, 1]] # 0 13 | - [-1, 1, ResNetLayer, [64, 64, 1, False, 3]] # 1 14 | - [-1, 1, ResNetLayer, [256, 128, 2, False, 4]] # 2 15 | - [-1, 1, ResNetLayer, [512, 256, 2, False, 23]] # 3 16 | - [-1, 1, ResNetLayer, [1024, 512, 2, False, 3]] # 4 17 | 18 | head: 19 | - [-1, 1, Conv, [256, 1, 1, None, 1, 1, False]] # 5 20 | - [-1, 1, AIFI, [1024, 8]] 21 | - [-1, 1, Conv, [256, 1, 1]] # 7 22 | 23 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 24 | - [3, 1, Conv, [256, 1, 1, None, 1, 1, False]] # 9 25 | - [[-2, -1], 1, Concat, [1]] 26 | - [-1, 3, RepC3, [256]] # 11 27 | - [-1, 1, Conv, [256, 1, 1]] # 12 28 | 29 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 30 | - [2, 1, Conv, [256, 1, 1, None, 1, 1, False]] # 14 31 | - [[-2, -1], 1, Concat, [1]] # cat backbone P4 32 | - [-1, 3, RepC3, [256]] # X3 (16), fpn_blocks.1 33 | 34 | - [-1, 1, Conv, [256, 3, 2]] # 17, downsample_convs.0 35 | - [[-1, 12], 1, Concat, [1]] # cat Y4 36 | - [-1, 3, RepC3, [256]] # F4 (19), pan_blocks.0 37 | 38 | - [-1, 1, Conv, [256, 3, 2]] # 20, downsample_convs.1 39 | - [[-1, 7], 1, Concat, [1]] # cat Y5 40 | - [-1, 3, RepC3, [256]] # F5 (22), pan_blocks.1 41 | 42 | - [[16, 19, 22], 1, RTDETRDecoder, [nc]] # Detect(P3, P4, P5) 43 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/rt-detr/rtdetr-resnet50.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # RT-DETR-ResNet50 object detection model with P3-P5 outputs. 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov8n-cls.yaml' will call yolov8-cls.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | l: [1.00, 1.00, 1024] 9 | 10 | backbone: 11 | # [from, repeats, module, args] 12 | - [-1, 1, ResNetLayer, [3, 64, 1, True, 1]] # 0 13 | - [-1, 1, ResNetLayer, [64, 64, 1, False, 3]] # 1 14 | - [-1, 1, ResNetLayer, [256, 128, 2, False, 4]] # 2 15 | - [-1, 1, ResNetLayer, [512, 256, 2, False, 6]] # 3 16 | - [-1, 1, ResNetLayer, [1024, 512, 2, False, 3]] # 4 17 | 18 | head: 19 | - [-1, 1, Conv, [256, 1, 1, None, 1, 1, False]] # 5 20 | - [-1, 1, AIFI, [1024, 8]] 21 | - [-1, 1, Conv, [256, 1, 1]] # 7 22 | 23 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 24 | - [3, 1, Conv, [256, 1, 1, None, 1, 1, False]] # 9 25 | - [[-2, -1], 1, Concat, [1]] 26 | - [-1, 3, RepC3, [256]] # 11 27 | - [-1, 1, Conv, [256, 1, 1]] # 12 28 | 29 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 30 | - [2, 1, Conv, [256, 1, 1, None, 1, 1, False]] # 14 31 | - [[-2, -1], 1, Concat, [1]] # cat backbone P4 32 | - [-1, 3, RepC3, [256]] # X3 (16), fpn_blocks.1 33 | 34 | - [-1, 1, Conv, [256, 3, 2]] # 17, downsample_convs.0 35 | - [[-1, 12], 1, Concat, [1]] # cat Y4 36 | - [-1, 3, RepC3, [256]] # F4 (19), pan_blocks.0 37 | 38 | - [-1, 1, Conv, [256, 3, 2]] # 20, downsample_convs.1 39 | - [[-1, 7], 1, Concat, [1]] # cat Y5 40 | - [-1, 3, RepC3, [256]] # F5 (22), pan_blocks.1 41 | 42 | - [[16, 19, 22], 1, RTDETRDecoder, [nc]] # Detect(P3, P4, P5) 43 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v10/yolov10_test.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv10 object detection model. For Usage examples see https://docs.ultralytics.com/tasks/detect 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov10n.yaml' will call yolov10.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | l: [1.00, 0.50, 1024] 9 | 10 | backbone: 11 | # [from, repeats, module, args] 12 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 13 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 14 | - [-1, 3, C2f, [128, True]] 15 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 16 | - [-1, 6, C2f, [256, True]] 17 | - [-1, 1, SCDown, [512, 3, 2]] # 5-P4/16 18 | - [-1, 6, C2f, [512, True]] 19 | - [-1, 1, SCDown, [1024, 3, 2]] # 7-P5/32 20 | - [-1, 3, C2fCIB, [1024, True]] 21 | - [-1, 1, SPPF, [1024, 5]] # 9 22 | - [-1, 1, PSA, [1024]] # 10 23 | 24 | # YOLOv10.0n head 25 | head: 26 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 27 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 28 | - [-1, 3, C2fCIB, [512, True]] # 13 29 | 30 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 31 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 32 | - [-1, 3, C2f, [256]] # 16 (P3/8-small) 33 | 34 | - [-1, 1, Conv, [256, 3, 2]] 35 | - [[-1, 13], 1, Concat, [1]] # cat head P4 36 | - [-1, 3, C2fCIB, [512, True]] # 19 (P4/16-medium) 37 | 38 | - [-1, 1, SCDown, [512, 3, 2]] 39 | - [[-1, 10], 1, Concat, [1]] # cat head P5 40 | - [-1, 3, C2fCIB, [1024, True]] # 22 (P5/32-large) 41 | 42 | - [[16, 19, 22], 1, v10Detect, [nc]] # Detect(P3, P4, P5) 43 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v10/yolov10b.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv10 object detection model. For Usage examples see https://docs.ultralytics.com/tasks/detect 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov10n.yaml' will call yolov10.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | b: [0.67, 1.00, 512] 9 | 10 | backbone: 11 | # [from, repeats, module, args] 12 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 13 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 14 | - [-1, 3, C2f, [128, True]] 15 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 16 | - [-1, 6, C2f, [256, True]] 17 | - [-1, 1, SCDown, [512, 3, 2]] # 5-P4/16 18 | - [-1, 6, C2f, [512, True]] 19 | - [-1, 1, SCDown, [1024, 3, 2]] # 7-P5/32 20 | - [-1, 3, C2fCIB, [1024, True]] 21 | - [-1, 1, SPPF, [1024, 5]] # 9 22 | - [-1, 1, PSA, [1024]] # 10 23 | 24 | # YOLOv10.0n head 25 | head: 26 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 27 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 28 | - [-1, 3, C2fCIB, [512, True]] # 13 29 | 30 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 31 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 32 | - [-1, 3, C2f, [256]] # 16 (P3/8-small) 33 | 34 | - [-1, 1, Conv, [256, 3, 2]] 35 | - [[-1, 13], 1, Concat, [1]] # cat head P4 36 | - [-1, 3, C2fCIB, [512, True]] # 19 (P4/16-medium) 37 | 38 | - [-1, 1, SCDown, [512, 3, 2]] 39 | - [[-1, 10], 1, Concat, [1]] # cat head P5 40 | - [-1, 3, C2fCIB, [1024, True]] # 22 (P5/32-large) 41 | 42 | - [[16, 19, 22], 1, v10Detect, [nc]] # Detect(P3, P4, P5) 43 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v10/yolov10l.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv10 object detection model. For Usage examples see https://docs.ultralytics.com/tasks/detect 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov10n.yaml' will call yolov10.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | l: [1.00, 1.00, 512] 9 | 10 | backbone: 11 | # [from, repeats, module, args] 12 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 13 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 14 | - [-1, 3, C2f, [128, True]] 15 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 16 | - [-1, 6, C2f, [256, True]] 17 | - [-1, 1, SCDown, [512, 3, 2]] # 5-P4/16 18 | - [-1, 6, C2f, [512, True]] 19 | - [-1, 1, SCDown, [1024, 3, 2]] # 7-P5/32 20 | - [-1, 3, C2fCIB, [1024, True]] 21 | - [-1, 1, SPPF, [1024, 5]] # 9 22 | - [-1, 1, PSA, [1024]] # 10 23 | 24 | # YOLOv10.0n head 25 | head: 26 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 27 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 28 | - [-1, 3, C2fCIB, [512, True]] # 13 29 | 30 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 31 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 32 | - [-1, 3, C2f, [256]] # 16 (P3/8-small) 33 | 34 | - [-1, 1, Conv, [256, 3, 2]] 35 | - [[-1, 13], 1, Concat, [1]] # cat head P4 36 | - [-1, 3, C2fCIB, [512, True]] # 19 (P4/16-medium) 37 | 38 | - [-1, 1, SCDown, [512, 3, 2]] 39 | - [[-1, 10], 1, Concat, [1]] # cat head P5 40 | - [-1, 3, C2fCIB, [1024, True]] # 22 (P5/32-large) 41 | 42 | - [[16, 19, 22], 1, v10Detect, [nc]] # Detect(P3, P4, P5) 43 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v10/yolov10m.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv10 object detection model. For Usage examples see https://docs.ultralytics.com/tasks/detect 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov10n.yaml' will call yolov10.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | m: [0.67, 0.75, 768] 9 | 10 | backbone: 11 | # [from, repeats, module, args] 12 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 13 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 14 | - [-1, 3, C2f, [128, True]] 15 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 16 | - [-1, 6, C2f, [256, True]] 17 | - [-1, 1, SCDown, [512, 3, 2]] # 5-P4/16 18 | - [-1, 6, C2f, [512, True]] 19 | - [-1, 1, SCDown, [1024, 3, 2]] # 7-P5/32 20 | - [-1, 3, C2fCIB, [1024, True]] 21 | - [-1, 1, SPPF, [1024, 5]] # 9 22 | - [-1, 1, PSA, [1024]] # 10 23 | 24 | # YOLOv10.0n head 25 | head: 26 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 27 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 28 | - [-1, 3, C2f, [512]] # 13 29 | 30 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 31 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 32 | - [-1, 3, C2f, [256]] # 16 (P3/8-small) 33 | 34 | - [-1, 1, Conv, [256, 3, 2]] 35 | - [[-1, 13], 1, Concat, [1]] # cat head P4 36 | - [-1, 3, C2fCIB, [512, True]] # 19 (P4/16-medium) 37 | 38 | - [-1, 1, SCDown, [512, 3, 2]] 39 | - [[-1, 10], 1, Concat, [1]] # cat head P5 40 | - [-1, 3, C2fCIB, [1024, True]] # 22 (P5/32-large) 41 | 42 | - [[16, 19, 22], 1, v10Detect, [nc]] # Detect(P3, P4, P5) 43 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v10/yolov10n-seg.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv10 object detection model. For Usage examples see https://docs.ultralytics.com/tasks/detect 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov10n.yaml' will call yolov10.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | n: [0.33, 0.25, 1024] 9 | 10 | backbone: 11 | # [from, repeats, module, args] 12 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 13 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 14 | - [-1, 3, C2f, [128, True]] 15 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 16 | - [-1, 6, C2f, [256, True]] 17 | - [-1, 1, SCDown, [512, 3, 2]] # 5-P4/16 Conv->SCDown 18 | - [-1, 6, C2f, [512, True]] 19 | - [-1, 1, SCDown, [1024, 3, 2]] # 7-P5/32 Conv->SCDown 20 | - [-1, 3, C2f, [1024, True]] 21 | - [-1, 1, SPPF, [1024, 5]] # 9 22 | - [-1, 1, PSA, [1024]] # 10 添加一层PSA 23 | 24 | # YOLOv10.0n head 25 | head: 26 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 27 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 28 | - [-1, 3, C2f, [512]] # 13 29 | 30 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 31 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 32 | - [-1, 3, C2f, [256]] # 16 (P3/8-small) 33 | 34 | - [-1, 1, Conv, [256, 3, 2]] 35 | - [[-1, 13], 1, Concat, [1]] # cat head P4 36 | - [-1, 3, C2f, [512]] # 19 (P4/16-medium) 37 | 38 | - [-1, 1, SCDown, [512, 3, 2]] # Conv->SCDown 39 | - [[-1, 10], 1, Concat, [1]] # cat head P5 40 | - [-1, 3, C2fCIB, [1024, True, True]] # 22 (P5/32-large) c2f->C2fCIB 41 | 42 | - [[16, 19, 22], 1, Segment, [nc, 32, 256]] # Detect(P3, P4, P5) 43 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v10/yolov10n.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv10 object detection model. For Usage examples see https://docs.ultralytics.com/tasks/detect 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov10n.yaml' will call yolov10.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | n: [0.33, 0.25, 1024] 9 | 10 | backbone: 11 | # [from, repeats, module, args] 12 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 13 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 14 | - [-1, 3, C2f, [128, True]] 15 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 16 | - [-1, 6, C2f, [256, True]] 17 | - [-1, 1, SCDown, [512, 3, 2]] # 5-P4/16 Conv->SCDown 18 | - [-1, 6, C2f, [512, True]] 19 | - [-1, 1, SCDown, [1024, 3, 2]] # 7-P5/32 Conv->SCDown 20 | - [-1, 3, C2f, [1024, True]] 21 | - [-1, 1, SPPF, [1024, 5]] # 9 22 | - [-1, 1, PSA, [1024]] # 10 添加一层PSA 23 | 24 | # YOLOv10.0n head 25 | head: 26 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 27 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 28 | - [-1, 3, C2f, [512]] # 13 29 | 30 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 31 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 32 | - [-1, 3, C2f, [256]] # 16 (P3/8-small) 33 | 34 | - [-1, 1, Conv, [256, 3, 2]] 35 | - [[-1, 13], 1, Concat, [1]] # cat head P4 36 | - [-1, 3, C2f, [512]] # 19 (P4/16-medium) 37 | 38 | - [-1, 1, SCDown, [512, 3, 2]] # Conv->SCDown 39 | - [[-1, 10], 1, Concat, [1]] # cat head P5 40 | - [-1, 3, C2fCIB, [1024, True, True]] # 22 (P5/32-large) c2f->C2fCIB 41 | 42 | - [[16, 19, 22], 1, v10Detect, [nc]] # Detect(P3, P4, P5) 43 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v10/yolov10s.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv10 object detection model. For Usage examples see https://docs.ultralytics.com/tasks/detect 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov10n.yaml' will call yolov10.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | s: [0.33, 0.50, 1024] 9 | 10 | backbone: 11 | # [from, repeats, module, args] 12 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 13 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 14 | - [-1, 3, C2f, [128, True]] 15 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 16 | - [-1, 6, C2f, [256, True]] 17 | - [-1, 1, SCDown, [512, 3, 2]] # 5-P4/16 18 | - [-1, 6, C2f, [512, True]] 19 | - [-1, 1, SCDown, [1024, 3, 2]] # 7-P5/32 20 | - [-1, 3, C2fCIB, [1024, True, True]] 21 | - [-1, 1, SPPF, [1024, 5]] # 9 22 | - [-1, 1, PSA, [1024]] # 10 23 | 24 | # YOLOv10.0n head 25 | head: 26 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 27 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 28 | - [-1, 3, C2f, [512]] # 13 29 | 30 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 31 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 32 | - [-1, 3, C2f, [256]] # 16 (P3/8-small) 33 | 34 | - [-1, 1, Conv, [256, 3, 2]] 35 | - [[-1, 13], 1, Concat, [1]] # cat head P4 36 | - [-1, 3, C2f, [512]] # 19 (P4/16-medium) 37 | 38 | - [-1, 1, SCDown, [512, 3, 2]] 39 | - [[-1, 10], 1, Concat, [1]] # cat head P5 40 | - [-1, 3, C2fCIB, [1024, True, True]] # 22 (P5/32-large) 41 | 42 | - [[16, 19, 22], 1, v10Detect, [nc]] # Detect(P3, P4, P5) 43 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v10/yolov10x.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv10 object detection model. For Usage examples see https://docs.ultralytics.com/tasks/detect 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov10n.yaml' will call yolov10.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | x: [1.00, 1.25, 512] 9 | 10 | backbone: 11 | # [from, repeats, module, args] 12 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 13 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 14 | - [-1, 3, C2f, [128, True]] 15 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 16 | - [-1, 6, C2f, [256, True]] 17 | - [-1, 1, SCDown, [512, 3, 2]] # 5-P4/16 18 | - [-1, 6, C2fCIB, [512, True]] 19 | - [-1, 1, SCDown, [1024, 3, 2]] # 7-P5/32 20 | - [-1, 3, C2fCIB, [1024, True]] 21 | - [-1, 1, SPPF, [1024, 5]] # 9 22 | - [-1, 1, PSA, [1024]] # 10 23 | 24 | # YOLOv10.0n head 25 | head: 26 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 27 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 28 | - [-1, 3, C2fCIB, [512, True]] # 13 29 | 30 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 31 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 32 | - [-1, 3, C2f, [256]] # 16 (P3/8-small) 33 | 34 | - [-1, 1, Conv, [256, 3, 2]] 35 | - [[-1, 13], 1, Concat, [1]] # cat head P4 36 | - [-1, 3, C2fCIB, [512, True]] # 19 (P4/16-medium) 37 | 38 | - [-1, 1, SCDown, [512, 3, 2]] 39 | - [[-1, 10], 1, Concat, [1]] # cat head P5 40 | - [-1, 3, C2fCIB, [1024, True]] # 22 (P5/32-large) 41 | 42 | - [[16, 19, 22], 1, v10Detect, [nc]] # Detect(P3, P4, P5) 43 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v3/yolov3-spp.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv3-SPP object detection model with P3-P5 outputs. For details see https://docs.ultralytics.com/models/yolov3 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | depth_multiple: 1.0 # model depth multiple 7 | width_multiple: 1.0 # layer channel multiple 8 | 9 | # darknet53 backbone 10 | backbone: 11 | # [from, number, module, args] 12 | - [-1, 1, Conv, [32, 3, 1]] # 0 13 | - [-1, 1, Conv, [64, 3, 2]] # 1-P1/2 14 | - [-1, 1, Bottleneck, [64]] 15 | - [-1, 1, Conv, [128, 3, 2]] # 3-P2/4 16 | - [-1, 2, Bottleneck, [128]] 17 | - [-1, 1, Conv, [256, 3, 2]] # 5-P3/8 18 | - [-1, 8, Bottleneck, [256]] 19 | - [-1, 1, Conv, [512, 3, 2]] # 7-P4/16 20 | - [-1, 8, Bottleneck, [512]] 21 | - [-1, 1, Conv, [1024, 3, 2]] # 9-P5/32 22 | - [-1, 4, Bottleneck, [1024]] # 10 23 | 24 | # YOLOv3-SPP head 25 | head: 26 | - [-1, 1, Bottleneck, [1024, False]] 27 | - [-1, 1, SPP, [512, [5, 9, 13]]] 28 | - [-1, 1, Conv, [1024, 3, 1]] 29 | - [-1, 1, Conv, [512, 1, 1]] 30 | - [-1, 1, Conv, [1024, 3, 1]] # 15 (P5/32-large) 31 | 32 | - [-2, 1, Conv, [256, 1, 1]] 33 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 34 | - [[-1, 8], 1, Concat, [1]] # cat backbone P4 35 | - [-1, 1, Bottleneck, [512, False]] 36 | - [-1, 1, Bottleneck, [512, False]] 37 | - [-1, 1, Conv, [256, 1, 1]] 38 | - [-1, 1, Conv, [512, 3, 1]] # 22 (P4/16-medium) 39 | 40 | - [-2, 1, Conv, [128, 1, 1]] 41 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 42 | - [[-1, 6], 1, Concat, [1]] # cat backbone P3 43 | - [-1, 1, Bottleneck, [256, False]] 44 | - [-1, 2, Bottleneck, [256, False]] # 27 (P3/8-small) 45 | 46 | - [[27, 22, 15], 1, Detect, [nc]] # Detect(P3, P4, P5) 47 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v3/yolov3-tiny.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv3-tiny object detection model with P4-P5 outputs. For details see https://docs.ultralytics.com/models/yolov3 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | depth_multiple: 1.0 # model depth multiple 7 | width_multiple: 1.0 # layer channel multiple 8 | 9 | # YOLOv3-tiny backbone 10 | backbone: 11 | # [from, number, module, args] 12 | - [-1, 1, Conv, [16, 3, 1]] # 0 13 | - [-1, 1, nn.MaxPool2d, [2, 2, 0]] # 1-P1/2 14 | - [-1, 1, Conv, [32, 3, 1]] 15 | - [-1, 1, nn.MaxPool2d, [2, 2, 0]] # 3-P2/4 16 | - [-1, 1, Conv, [64, 3, 1]] 17 | - [-1, 1, nn.MaxPool2d, [2, 2, 0]] # 5-P3/8 18 | - [-1, 1, Conv, [128, 3, 1]] 19 | - [-1, 1, nn.MaxPool2d, [2, 2, 0]] # 7-P4/16 20 | - [-1, 1, Conv, [256, 3, 1]] 21 | - [-1, 1, nn.MaxPool2d, [2, 2, 0]] # 9-P5/32 22 | - [-1, 1, Conv, [512, 3, 1]] 23 | - [-1, 1, nn.ZeroPad2d, [[0, 1, 0, 1]]] # 11 24 | - [-1, 1, nn.MaxPool2d, [2, 1, 0]] # 12 25 | 26 | # YOLOv3-tiny head 27 | head: 28 | - [-1, 1, Conv, [1024, 3, 1]] 29 | - [-1, 1, Conv, [256, 1, 1]] 30 | - [-1, 1, Conv, [512, 3, 1]] # 15 (P5/32-large) 31 | 32 | - [-2, 1, Conv, [128, 1, 1]] 33 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 34 | - [[-1, 8], 1, Concat, [1]] # cat backbone P4 35 | - [-1, 1, Conv, [256, 3, 1]] # 19 (P4/16-medium) 36 | 37 | - [[19, 15], 1, Detect, [nc]] # Detect(P4, P5) 38 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v3/yolov3.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv3 object detection model with P3-P5 outputs. For details see https://docs.ultralytics.com/models/yolov3 3 | # scale: 's' 4 | # Parameters 5 | nc: 80 # number of classes 6 | # depth_multiple: 1.0 # model depth multiple 7 | # width_multiple: 1.0 # layer channel multiple 8 | scales: # model compound scaling constants, i.e. 'model=yolov5n.yaml' will call yolov5.yaml with scale 'n' 9 | # [depth, width, max_channels] 10 | n: [0.33, 0.25, 1024] 11 | s: [0.33, 0.40, 1024] 12 | m: [0.67, 0.75, 1024] 13 | l: [1.00, 1.00, 1024] 14 | x: [1.33, 1.25, 1024] 15 | 16 | # darknet53 backbone 17 | backbone: 18 | # [from, number, module, args] 19 | - [-1, 1, Conv, [32, 3, 1]] # 0 20 | - [-1, 1, Conv, [64, 3, 2]] # 1-P1/2 21 | - [-1, 1, Bottleneck, [64]] 22 | - [-1, 1, Conv, [128, 3, 2]] # 3-P2/4 23 | - [-1, 2, Bottleneck, [128]] 24 | - [-1, 1, Conv, [256, 3, 2]] # 5-P3/8 25 | - [-1, 8, Bottleneck, [256]] 26 | - [-1, 1, Conv, [512, 3, 2]] # 7-P4/16 27 | - [-1, 8, Bottleneck, [512]] 28 | - [-1, 1, Conv, [1024, 3, 2]] # 9-P5/32 29 | - [-1, 4, Bottleneck, [1024]] # 10 30 | 31 | # YOLOv3 head 32 | head: 33 | - [-1, 1, Bottleneck, [1024, False]] 34 | - [-1, 1, Conv, [512, 1, 1]] 35 | - [-1, 1, Conv, [1024, 3, 1]] 36 | - [-1, 1, Conv, [512, 1, 1]] 37 | - [-1, 1, Conv, [1024, 3, 1]] # 15 (P5/32-large) 38 | 39 | - [-2, 1, Conv, [256, 1, 1]] 40 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 41 | - [[-1, 8], 1, Concat, [1]] # cat backbone P4 42 | - [-1, 1, Bottleneck, [512, False]] 43 | - [-1, 1, Bottleneck, [512, False]] 44 | - [-1, 1, Conv, [256, 1, 1]] 45 | - [-1, 1, Conv, [512, 3, 1]] # 22 (P4/16-medium) 46 | 47 | - [-2, 1, Conv, [128, 1, 1]] 48 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 49 | - [[-1, 6], 1, Concat, [1]] # cat backbone P3 50 | - [-1, 1, Bottleneck, [256, False]] 51 | - [-1, 2, Bottleneck, [256, False]] # 27 (P3/8-small) 52 | 53 | - [[27, 22, 15], 1, Detect, [nc]] # Detect(P3, P4, P5) 54 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v5/yolov5.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv5 object detection model with P3-P5 outputs. For details see https://docs.ultralytics.com/models/yolov5 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov5n.yaml' will call yolov5.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | n: [0.33, 0.25, 1024] 9 | s: [0.33, 0.50, 1024] 10 | m: [0.67, 0.75, 1024] 11 | l: [1.00, 1.00, 1024] 12 | x: [1.33, 1.25, 1024] 13 | 14 | # YOLOv5 v6.0 backbone 15 | backbone: 16 | # [from, number, module, args] 17 | - [-1, 1, Conv, [64, 6, 2, 2]] # 0-P1/2 18 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 19 | - [-1, 3, C3, [128]] 20 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 21 | - [-1, 6, C3, [256]] 22 | - [-1, 1, Conv, [512, 3, 2]] # 5-P4/16 23 | - [-1, 9, C3, [512]] 24 | - [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32 25 | - [-1, 3, C3, [1024]] 26 | - [-1, 1, SPPF, [1024, 5]] # 9 27 | 28 | # YOLOv5 v6.0 head 29 | head: 30 | - [-1, 1, Conv, [512, 1, 1]] 31 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 32 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 33 | - [-1, 3, C3, [512, False]] # 13 34 | 35 | - [-1, 1, Conv, [256, 1, 1]] 36 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 37 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 38 | - [-1, 3, C3, [256, False]] # 17 (P3/8-small) 39 | 40 | - [-1, 1, Conv, [256, 3, 2]] 41 | - [[-1, 14], 1, Concat, [1]] # cat head P4 42 | - [-1, 3, C3, [512, False]] # 20 (P4/16-medium) 43 | 44 | - [-1, 1, Conv, [512, 3, 2]] 45 | - [[-1, 10], 1, Concat, [1]] # cat head P5 46 | - [-1, 3, C3, [1024, False]] # 23 (P5/32-large) 47 | 48 | - [[17, 20, 23], 1, Detect, [nc]] # Detect(P3, P4, P5) 49 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v6/yolov6.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv6 object detection model with P3-P5 outputs. For Usage examples see https://docs.ultralytics.com/models/yolov6 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | activation: nn.ReLU() # (optional) model default activation function 7 | scales: # model compound scaling constants, i.e. 'model=yolov6n.yaml' will call yolov8.yaml with scale 'n' 8 | # [depth, width, max_channels] 9 | n: [0.33, 0.25, 1024] 10 | s: [0.33, 0.40, 1024] 11 | m: [0.67, 0.75, 768] 12 | l: [1.00, 1.00, 512] 13 | x: [1.00, 1.25, 512] 14 | 15 | # YOLOv6-3.0s backbone 16 | backbone: 17 | # [from, repeats, module, args] 18 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 19 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 20 | - [-1, 6, Conv, [128, 3, 1]] 21 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 22 | - [-1, 12, Conv, [256, 3, 1]] 23 | - [-1, 1, Conv, [512, 3, 2]] # 5-P4/16 24 | - [-1, 18, Conv, [512, 3, 1]] 25 | - [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32 26 | - [-1, 6, Conv, [1024, 3, 1]] 27 | - [-1, 1, SPPF, [1024, 5]] # 9 28 | 29 | # YOLOv6-3.0s head 30 | head: 31 | - [-1, 1, Conv, [256, 1, 1]] 32 | - [-1, 1, nn.ConvTranspose2d, [256, 2, 2, 0]] 33 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 34 | - [-1, 1, Conv, [256, 3, 1]] 35 | - [-1, 9, Conv, [256, 3, 1]] # 14 36 | 37 | - [-1, 1, Conv, [128, 1, 1]] 38 | - [-1, 1, nn.ConvTranspose2d, [128, 2, 2, 0]] 39 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 40 | - [-1, 1, Conv, [128, 3, 1]] 41 | - [-1, 9, Conv, [128, 3, 1]] # 19 42 | 43 | - [-1, 1, Conv, [128, 3, 2]] 44 | - [[-1, 15], 1, Concat, [1]] # cat head P4 45 | - [-1, 1, Conv, [256, 3, 1]] 46 | - [-1, 9, Conv, [256, 3, 1]] # 23 47 | 48 | - [-1, 1, Conv, [256, 3, 2]] 49 | - [[-1, 10], 1, Concat, [1]] # cat head P5 50 | - [-1, 1, Conv, [512, 3, 1]] 51 | - [-1, 9, Conv, [512, 3, 1]] # 27 52 | 53 | - [[19, 23, 27], 1, Detect, [nc]] # Detect(P3, P4, P5) 54 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v8/yolov8-cls-resnet101.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv8-cls image classification model. For Usage examples see https://docs.ultralytics.com/tasks/classify 3 | 4 | # Parameters 5 | nc: 1000 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov8n-cls.yaml' will call yolov8-cls.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | n: [0.33, 0.25, 1024] 9 | s: [0.33, 0.50, 1024] 10 | m: [0.67, 0.75, 1024] 11 | l: [1.00, 1.00, 1024] 12 | x: [1.00, 1.25, 1024] 13 | 14 | # YOLOv8.0n backbone 15 | backbone: 16 | # [from, repeats, module, args] 17 | - [-1, 1, ResNetLayer, [3, 64, 1, True, 1]] # 0-P1/2 18 | - [-1, 1, ResNetLayer, [64, 64, 1, False, 3]] # 1-P2/4 19 | - [-1, 1, ResNetLayer, [256, 128, 2, False, 4]] # 2-P3/8 20 | - [-1, 1, ResNetLayer, [512, 256, 2, False, 23]] # 3-P4/16 21 | - [-1, 1, ResNetLayer, [1024, 512, 2, False, 3]] # 4-P5/32 22 | 23 | # YOLOv8.0n head 24 | head: 25 | - [-1, 1, Classify, [nc]] # Classify 26 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v8/yolov8-cls-resnet50.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv8-cls image classification model. For Usage examples see https://docs.ultralytics.com/tasks/classify 3 | 4 | # Parameters 5 | nc: 1000 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov8n-cls.yaml' will call yolov8-cls.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | n: [0.33, 0.25, 1024] 9 | s: [0.33, 0.50, 1024] 10 | m: [0.67, 0.75, 1024] 11 | l: [1.00, 1.00, 1024] 12 | x: [1.00, 1.25, 1024] 13 | 14 | # YOLOv8.0n backbone 15 | backbone: 16 | # [from, repeats, module, args] 17 | - [-1, 1, ResNetLayer, [3, 64, 1, True, 1]] # 0-P1/2 18 | - [-1, 1, ResNetLayer, [64, 64, 1, False, 3]] # 1-P2/4 19 | - [-1, 1, ResNetLayer, [256, 128, 2, False, 4]] # 2-P3/8 20 | - [-1, 1, ResNetLayer, [512, 256, 2, False, 6]] # 3-P4/16 21 | - [-1, 1, ResNetLayer, [1024, 512, 2, False, 3]] # 4-P5/32 22 | 23 | # YOLOv8.0n head 24 | head: 25 | - [-1, 1, Classify, [nc]] # Classify 26 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v8/yolov8-cls.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv8-cls image classification model. For Usage examples see https://docs.ultralytics.com/tasks/classify 3 | 4 | # Parameters 5 | nc: 1000 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov8n-cls.yaml' will call yolov8-cls.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | n: [0.33, 0.25, 1024] 9 | s: [0.33, 0.50, 1024] 10 | m: [0.67, 0.75, 1024] 11 | l: [1.00, 1.00, 1024] 12 | x: [1.00, 1.25, 1024] 13 | 14 | # YOLOv8.0n backbone 15 | backbone: 16 | # [from, repeats, module, args] 17 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 18 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 19 | - [-1, 3, C2f, [128, True]] 20 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 21 | - [-1, 6, C2f, [256, True]] 22 | - [-1, 1, Conv, [512, 3, 2]] # 5-P4/16 23 | - [-1, 6, C2f, [512, True]] 24 | - [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32 25 | - [-1, 3, C2f, [1024, True]] 26 | 27 | # YOLOv8.0n head 28 | head: 29 | - [-1, 1, Classify, [nc]] # Classify 30 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v8/yolov8-obb.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv8 Oriented Bounding Boxes (OBB) model with P3-P5 outputs. For Usage examples see https://docs.ultralytics.com/tasks/detect 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov8n.yaml' will call yolov8.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | n: [0.33, 0.25, 1024] # YOLOv8n summary: 225 layers, 3157200 parameters, 3157184 gradients, 8.9 GFLOPs 9 | s: [0.33, 0.50, 1024] # YOLOv8s summary: 225 layers, 11166560 parameters, 11166544 gradients, 28.8 GFLOPs 10 | m: [0.67, 0.75, 768] # YOLOv8m summary: 295 layers, 25902640 parameters, 25902624 gradients, 79.3 GFLOPs 11 | l: [1.00, 1.00, 512] # YOLOv8l summary: 365 layers, 43691520 parameters, 43691504 gradients, 165.7 GFLOPs 12 | x: [1.00, 1.25, 512] # YOLOv8x summary: 365 layers, 68229648 parameters, 68229632 gradients, 258.5 GFLOPs 13 | 14 | # YOLOv8.0n backbone 15 | backbone: 16 | # [from, repeats, module, args] 17 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 18 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 19 | - [-1, 3, C2f, [128, True]] 20 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 21 | - [-1, 6, C2f, [256, True]] 22 | - [-1, 1, Conv, [512, 3, 2]] # 5-P4/16 23 | - [-1, 6, C2f, [512, True]] 24 | - [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32 25 | - [-1, 3, C2f, [1024, True]] 26 | - [-1, 1, SPPF, [1024, 5]] # 9 27 | 28 | # YOLOv8.0n head 29 | head: 30 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 31 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 32 | - [-1, 3, C2f, [512]] # 12 33 | 34 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 35 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 36 | - [-1, 3, C2f, [256]] # 15 (P3/8-small) 37 | 38 | - [-1, 1, Conv, [256, 3, 2]] 39 | - [[-1, 12], 1, Concat, [1]] # cat head P4 40 | - [-1, 3, C2f, [512]] # 18 (P4/16-medium) 41 | 42 | - [-1, 1, Conv, [512, 3, 2]] 43 | - [[-1, 9], 1, Concat, [1]] # cat head P5 44 | - [-1, 3, C2f, [1024]] # 21 (P5/32-large) 45 | 46 | - [[15, 18, 21], 1, OBB, [nc, 1]] # OBB(P3, P4, P5) 47 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v8/yolov8-p2.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv8 object detection model with P2-P5 outputs. For Usage examples see https://docs.ultralytics.com/tasks/detect 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov8n.yaml' will call yolov8.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | n: [0.33, 0.25, 1024] 9 | s: [0.33, 0.48, 1024] 10 | m: [0.67, 0.75, 768] 11 | l: [1.00, 1.00, 512] 12 | x: [1.00, 1.25, 512] 13 | 14 | # YOLOv8.0 backbone 15 | backbone: 16 | # [from, repeats, module, args] 17 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 18 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 19 | - [-1, 3, C2f, [128, True]] 20 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 21 | - [-1, 6, C2f, [256, True]] 22 | - [-1, 1, Conv, [512, 3, 2]] # 5-P4/16 23 | - [-1, 6, C2f, [512, True]] 24 | - [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32 25 | - [-1, 3, C2f, [1024, True]] 26 | - [-1, 1, SPPF, [1024, 5]] # 9 27 | 28 | # YOLOv8.0-p2 head 29 | head: 30 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 31 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 32 | - [-1, 3, C2f, [512]] # 12 33 | 34 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 35 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 36 | - [-1, 3, C2f, [256]] # 15 (P3/8-small) 37 | 38 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 39 | - [[-1, 2], 1, Concat, [1]] # cat backbone P2 40 | - [-1, 3, C2f, [128]] # 18 (P2/4-xsmall) 41 | 42 | - [-1, 1, Conv, [128, 3, 2]] 43 | - [[-1, 15], 1, Concat, [1]] # cat head P3 44 | - [-1, 3, C2f, [256]] # 21 (P3/8-small) 45 | 46 | - [-1, 1, Conv, [256, 3, 2]] 47 | - [[-1, 12], 1, Concat, [1]] # cat head P4 48 | - [-1, 3, C2f, [512]] # 24 (P4/16-medium) 49 | 50 | - [-1, 1, Conv, [512, 3, 2]] 51 | - [[-1, 9], 1, Concat, [1]] # cat head P5 52 | - [-1, 3, C2f, [1024]] # 27 (P5/32-large) 53 | 54 | - [[18, 21, 24, 27], 1, Detect, [nc]] # Detect(P2, P3, P4, P5) 55 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v8/yolov8-pose.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv8-pose keypoints/pose estimation model. For Usage examples see https://docs.ultralytics.com/tasks/pose 3 | 4 | # Parameters 5 | nc: 1 # number of classes 6 | kpt_shape: [17, 3] # number of keypoints, number of dims (2 for x,y or 3 for x,y,visible) 7 | scales: # model compound scaling constants, i.e. 'model=yolov8n-pose.yaml' will call yolov8-pose.yaml with scale 'n' 8 | # [depth, width, max_channels] 9 | n: [0.33, 0.25, 1024] 10 | s: [0.33, 0.50, 1024] 11 | m: [0.67, 0.75, 768] 12 | l: [1.00, 1.00, 512] 13 | x: [1.00, 1.25, 512] 14 | 15 | # YOLOv8.0n backbone 16 | backbone: 17 | # [from, repeats, module, args] 18 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 19 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 20 | - [-1, 3, C2f, [128, True]] 21 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 22 | - [-1, 6, C2f, [256, True]] 23 | - [-1, 1, Conv, [512, 3, 2]] # 5-P4/16 24 | - [-1, 6, C2f, [512, True]] 25 | - [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32 26 | - [-1, 3, C2f, [1024, True]] 27 | - [-1, 1, SPPF, [1024, 5]] # 9 28 | 29 | # YOLOv8.0n head 30 | head: 31 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 32 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 33 | - [-1, 3, C2f, [512]] # 12 34 | 35 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 36 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 37 | - [-1, 3, C2f, [256]] # 15 (P3/8-small) 38 | 39 | - [-1, 1, Conv, [256, 3, 2]] 40 | - [[-1, 12], 1, Concat, [1]] # cat head P4 41 | - [-1, 3, C2f, [512]] # 18 (P4/16-medium) 42 | 43 | - [-1, 1, Conv, [512, 3, 2]] 44 | - [[-1, 9], 1, Concat, [1]] # cat head P5 45 | - [-1, 3, C2f, [1024]] # 21 (P5/32-large) 46 | 47 | - [[15, 18, 21], 1, Pose, [nc, kpt_shape]] # Pose(P3, P4, P5) 48 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v8/yolov8-rtdetr.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv8 object detection model with P3-P5 outputs. For Usage examples see https://docs.ultralytics.com/tasks/detect 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov8n.yaml' will call yolov8.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | n: [0.33, 0.25, 1024] # YOLOv8n summary: 225 layers, 3157200 parameters, 3157184 gradients, 8.9 GFLOPs 9 | s: [0.33, 0.50, 1024] # YOLOv8s summary: 225 layers, 11166560 parameters, 11166544 gradients, 28.8 GFLOPs 10 | m: [0.67, 0.75, 768] # YOLOv8m summary: 295 layers, 25902640 parameters, 25902624 gradients, 79.3 GFLOPs 11 | l: [1.00, 1.00, 512] # YOLOv8l summary: 365 layers, 43691520 parameters, 43691504 gradients, 165.7 GFLOPs 12 | x: [1.00, 1.25, 512] # YOLOv8x summary: 365 layers, 68229648 parameters, 68229632 gradients, 258.5 GFLOPs 13 | 14 | # YOLOv8.0n backbone 15 | backbone: 16 | # [from, repeats, module, args] 17 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 18 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 19 | - [-1, 3, C2f, [128, True]] 20 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 21 | - [-1, 6, C2f, [256, True]] 22 | - [-1, 1, Conv, [512, 3, 2]] # 5-P4/16 23 | - [-1, 6, C2f, [512, True]] 24 | - [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32 25 | - [-1, 3, C2f, [1024, True]] 26 | - [-1, 1, SPPF, [1024, 5]] # 9 27 | 28 | # YOLOv8.0n head 29 | head: 30 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 31 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 32 | - [-1, 3, C2f, [512]] # 12 33 | 34 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 35 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 36 | - [-1, 3, C2f, [256]] # 15 (P3/8-small) 37 | 38 | - [-1, 1, Conv, [256, 3, 2]] 39 | - [[-1, 12], 1, Concat, [1]] # cat head P4 40 | - [-1, 3, C2f, [512]] # 18 (P4/16-medium) 41 | 42 | - [-1, 1, Conv, [512, 3, 2]] 43 | - [[-1, 9], 1, Concat, [1]] # cat head P5 44 | - [-1, 3, C2f, [1024]] # 21 (P5/32-large) 45 | 46 | - [[15, 18, 21], 1, RTDETRDecoder, [nc]] # Detect(P3, P4, P5) 47 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v8/yolov8-seg-p6.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv8-seg-p6 instance segmentation model. For Usage examples see https://docs.ultralytics.com/tasks/segment 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov8n-seg-p6.yaml' will call yolov8-seg-p6.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | n: [0.33, 0.25, 1024] 9 | s: [0.33, 0.50, 1024] 10 | m: [0.67, 0.75, 768] 11 | l: [1.00, 1.00, 512] 12 | x: [1.00, 1.25, 512] 13 | 14 | # YOLOv8.0x6 backbone 15 | backbone: 16 | # [from, repeats, module, args] 17 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 18 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 19 | - [-1, 3, C2f, [128, True]] 20 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 21 | - [-1, 6, C2f, [256, True]] 22 | - [-1, 1, Conv, [512, 3, 2]] # 5-P4/16 23 | - [-1, 6, C2f, [512, True]] 24 | - [-1, 1, Conv, [768, 3, 2]] # 7-P5/32 25 | - [-1, 3, C2f, [768, True]] 26 | - [-1, 1, Conv, [1024, 3, 2]] # 9-P6/64 27 | - [-1, 3, C2f, [1024, True]] 28 | - [-1, 1, SPPF, [1024, 5]] # 11 29 | 30 | # YOLOv8.0x6 head 31 | head: 32 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 33 | - [[-1, 8], 1, Concat, [1]] # cat backbone P5 34 | - [-1, 3, C2, [768, False]] # 14 35 | 36 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 37 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 38 | - [-1, 3, C2, [512, False]] # 17 39 | 40 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 41 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 42 | - [-1, 3, C2, [256, False]] # 20 (P3/8-small) 43 | 44 | - [-1, 1, Conv, [256, 3, 2]] 45 | - [[-1, 17], 1, Concat, [1]] # cat head P4 46 | - [-1, 3, C2, [512, False]] # 23 (P4/16-medium) 47 | 48 | - [-1, 1, Conv, [512, 3, 2]] 49 | - [[-1, 14], 1, Concat, [1]] # cat head P5 50 | - [-1, 3, C2, [768, False]] # 26 (P5/32-large) 51 | 52 | - [-1, 1, Conv, [768, 3, 2]] 53 | - [[-1, 11], 1, Concat, [1]] # cat head P6 54 | - [-1, 3, C2, [1024, False]] # 29 (P6/64-xlarge) 55 | 56 | - [[20, 23, 26, 29], 1, Segment, [nc, 32, 256]] # Pose(P3, P4, P5, P6) 57 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v8/yolov8-seg.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv8-seg instance segmentation model. For Usage examples see https://docs.ultralytics.com/tasks/segment 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov8n-seg.yaml' will call yolov8-seg.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | n: [0.33, 0.25, 1024] 9 | s: [0.33, 0.50, 1024] 10 | m: [0.67, 0.75, 768] 11 | l: [1.00, 1.00, 1024] 12 | x: [1.00, 1.25, 512] 13 | 14 | # YOLOv8.0n backbone 15 | backbone: 16 | # [from, repeats, module, args] 17 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 18 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 19 | - [-1, 3, C2f, [128, True]] 20 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 21 | - [-1, 6, C2f, [256, True]] 22 | - [-1, 1, Conv, [512, 3, 2]] # 5-P4/16 23 | - [-1, 6, C2f, [512, True]] 24 | - [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32 25 | - [-1, 3, C2f, [1024, True]] 26 | - [-1, 1, SPPF, [1024, 5]] # 9 27 | 28 | # YOLOv8.0n head 29 | head: 30 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 31 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 32 | - [-1, 3, C2f, [512]] # 12 33 | 34 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 35 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 36 | - [-1, 3, C2f, [256]] # 15 (P3/8-small) 37 | 38 | - [-1, 1, Conv, [256, 3, 2]] 39 | - [[-1, 12], 1, Concat, [1]] # cat head P4 40 | - [-1, 3, C2f, [512]] # 18 (P4/16-medium) 41 | 42 | - [-1, 1, Conv, [512, 3, 2]] 43 | - [[-1, 9], 1, Concat, [1]] # cat head P5 44 | - [-1, 3, C2f, [1024]] # 21 (P5/32-large) 45 | 46 | - [[15, 18, 21], 1, Segment, [nc, 32, 256]] # Segment(P3, P4, P5) 47 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v8/yolov8.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv8 object detection model with P3-P5 outputs. For Usage examples see https://docs.ultralytics.com/tasks/detect 3 | 4 | # Parameters 5 | nc: 80 # number of classes 6 | scales: # model compound scaling constants, i.e. 'model=yolov8n.yaml' will call yolov8.yaml with scale 'n' 7 | # [depth, width, max_channels] 8 | n: [0.33, 0.25, 1024] # YOLOv8n summary: 225 layers, 3157200 parameters, 3157184 gradients, 8.9 GFLOPs 9 | s: [0.33, 0.50, 1024] # YOLOv8s summary: 225 layers, 11166560 parameters, 11166544 gradients, 28.8 GFLOPs 10 | m: [0.67, 0.75, 768] # YOLOv8m summary: 295 layers, 25902640 parameters, 25902624 gradients, 79.3 GFLOPs 11 | l: [1.00, 1.00, 512] # YOLOv8l summary: 365 layers, 43691520 parameters, 43691504 gradients, 165.7 GFLOPs 12 | x: [1.00, 1.25, 512] # YOLOv8x summary: 365 layers, 68229648 parameters, 68229632 gradients, 258.5 GFLOPs 13 | 14 | # YOLOv8.0n backbone 15 | backbone: 16 | # [from, repeats, module, args] 17 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 18 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 19 | - [-1, 3, C2f, [128, True]] 20 | - [-1, 1, Conv, [256, 3, 2]] # 3-P3/8 21 | - [-1, 6, C2f, [256, True]] 22 | - [-1, 1, Conv, [512, 3, 2]] # 5-P4/16 23 | - [-1, 6, C2f, [512, True]] 24 | - [-1, 1, Conv, [1024, 3, 2]] # 7-P5/32 25 | - [-1, 3, C2f, [1024, True]] 26 | - [-1, 1, SPPF, [1024, 5]] # 9 27 | 28 | # YOLOv8.0n head 29 | head: 30 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 31 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 32 | - [-1, 3, C2f, [512]] # 12 33 | 34 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 35 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 36 | - [-1, 3, C2f, [256]] # 15 (P3/8-small) 37 | 38 | - [-1, 1, Conv, [256, 3, 2]] 39 | - [[-1, 12], 1, Concat, [1]] # cat head P4 40 | - [-1, 3, C2f, [512]] # 18 (P4/16-medium) 41 | 42 | - [-1, 1, Conv, [512, 3, 2]] 43 | - [[-1, 9], 1, Concat, [1]] # cat head P5 44 | - [-1, 3, C2f, [1024]] # 21 (P5/32-large) 45 | 46 | - [[15, 18, 21], 1, Detect, [nc]] # Detect(P3, P4, P5) 47 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v9/yolov9c-seg.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv9c-seg instance segmentation model. For Usage examples see https://docs.ultralytics.com/models/yolov9 3 | # 654 layers, 27897120 parameters, 159.4 GFLOPs 4 | 5 | # Parameters 6 | nc: 80 # number of classes 7 | 8 | # GELAN backbone 9 | backbone: 10 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 11 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 12 | - [-1, 1, RepNCSPELAN4, [256, 128, 64, 1]] # 2 13 | - [-1, 1, ADown, [256]] # 3-P3/8 14 | - [-1, 1, RepNCSPELAN4, [512, 256, 128, 1]] # 4 15 | - [-1, 1, ADown, [512]] # 5-P4/16 16 | - [-1, 1, RepNCSPELAN4, [512, 512, 256, 1]] # 6 17 | - [-1, 1, ADown, [512]] # 7-P5/32 18 | - [-1, 1, RepNCSPELAN4, [512, 512, 256, 1]] # 8 19 | - [-1, 1, SPPELAN, [512, 256]] # 9 20 | 21 | head: 22 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 23 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 24 | - [-1, 1, RepNCSPELAN4, [512, 512, 256, 1]] # 12 25 | 26 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 27 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 28 | - [-1, 1, RepNCSPELAN4, [256, 256, 128, 1]] # 15 (P3/8-small) 29 | 30 | - [-1, 1, ADown, [256]] 31 | - [[-1, 12], 1, Concat, [1]] # cat head P4 32 | - [-1, 1, RepNCSPELAN4, [512, 512, 256, 1]] # 18 (P4/16-medium) 33 | 34 | - [-1, 1, ADown, [512]] 35 | - [[-1, 9], 1, Concat, [1]] # cat head P5 36 | - [-1, 1, RepNCSPELAN4, [512, 512, 256, 1]] # 21 (P5/32-large) 37 | 38 | - [[15, 18, 21], 1, Segment, [nc, 32, 256]] # Segment(P3, P4, P5) 39 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v9/yolov9c.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv9c object detection model. For Usage examples see https://docs.ultralytics.com/models/yolov9 3 | # 618 layers, 25590912 parameters, 104.0 GFLOPs 4 | 5 | # Parameters 6 | nc: 80 # number of classes 7 | 8 | # GELAN backbone 9 | backbone: 10 | - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 11 | - [-1, 1, Conv, [128, 3, 2]] # 1-P2/4 12 | - [-1, 1, RepNCSPELAN4, [256, 128, 64, 1]] # 2 13 | - [-1, 1, ADown, [256]] # 3-P3/8 14 | - [-1, 1, RepNCSPELAN4, [512, 256, 128, 1]] # 4 15 | - [-1, 1, ADown, [512]] # 5-P4/16 16 | - [-1, 1, RepNCSPELAN4, [512, 512, 256, 1]] # 6 17 | - [-1, 1, ADown, [512]] # 7-P5/32 18 | - [-1, 1, RepNCSPELAN4, [512, 512, 256, 1]] # 8 19 | - [-1, 1, SPPELAN, [512, 256]] # 9 20 | 21 | head: 22 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 23 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 24 | - [-1, 1, RepNCSPELAN4, [512, 512, 256, 1]] # 12 25 | 26 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 27 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 28 | - [-1, 1, RepNCSPELAN4, [256, 256, 128, 1]] # 15 (P3/8-small) 29 | 30 | - [-1, 1, ADown, [256]] 31 | - [[-1, 12], 1, Concat, [1]] # cat head P4 32 | - [-1, 1, RepNCSPELAN4, [512, 512, 256, 1]] # 18 (P4/16-medium) 33 | 34 | - [-1, 1, ADown, [512]] 35 | - [[-1, 9], 1, Concat, [1]] # cat head P5 36 | - [-1, 1, RepNCSPELAN4, [512, 512, 256, 1]] # 21 (P5/32-large) 37 | 38 | - [[15, 18, 21], 1, Detect, [nc]] # Detect(P3, P4, P5) 39 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v9/yolov9m.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv9m object detection model. For Usage examples see https://docs.ultralytics.com/models/yolov9 3 | # 603 layers, 20216160 parameters, 77.9 GFLOPs 4 | 5 | # Parameters 6 | nc: 80 # number of classes 7 | 8 | # GELAN backbone 9 | backbone: 10 | - [-1, 1, Conv, [32, 3, 2]] # 0-P1/2 11 | - [-1, 1, Conv, [64, 3, 2]] # 1-P2/4 12 | - [-1, 1, RepNCSPELAN4, [128, 128, 64, 1]] # 2 13 | - [-1, 1, AConv, [240]] # 3-P3/8 14 | - [-1, 1, RepNCSPELAN4, [240, 240, 120, 1]] # 4 15 | - [-1, 1, AConv, [360]] # 5-P4/16 16 | - [-1, 1, RepNCSPELAN4, [360, 360, 180, 1]] # 6 17 | - [-1, 1, AConv, [480]] # 7-P5/32 18 | - [-1, 1, RepNCSPELAN4, [480, 480, 240, 1]] # 8 19 | - [-1, 1, SPPELAN, [480, 240]] # 9 20 | 21 | head: 22 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 23 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 24 | - [-1, 1, RepNCSPELAN4, [360, 360, 180, 1]] # 12 25 | 26 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 27 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 28 | - [-1, 1, RepNCSPELAN4, [240, 240, 120, 1]] # 15 29 | 30 | - [-1, 1, AConv, [180]] 31 | - [[-1, 12], 1, Concat, [1]] # cat head P4 32 | - [-1, 1, RepNCSPELAN4, [360, 360, 180, 1]] # 18 (P4/16-medium) 33 | 34 | - [-1, 1, AConv, [240]] 35 | - [[-1, 9], 1, Concat, [1]] # cat head P5 36 | - [-1, 1, RepNCSPELAN4, [480, 480, 240, 1]] # 21 (P5/32-large) 37 | 38 | - [[15, 18, 21], 1, Detect, [nc]] # Detect(P3, P4, P5) 39 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v9/yolov9s.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv9s object detection model. For Usage examples see https://docs.ultralytics.com/models/yolov9 3 | # 917 layers, 7318368 parameters, 27.6 GFLOPs 4 | 5 | # Parameters 6 | nc: 80 # number of classes 7 | 8 | # GELAN backbone 9 | backbone: 10 | - [-1, 1, Conv, [32, 3, 2]] # 0-P1/2 11 | - [-1, 1, Conv, [64, 3, 2]] # 1-P2/4 12 | - [-1, 1, ELAN1, [64, 64, 32]] # 2 13 | - [-1, 1, AConv, [128]] # 3-P3/8 14 | - [-1, 1, RepNCSPELAN4, [128, 128, 64, 3]] # 4 15 | - [-1, 1, AConv, [192]] # 5-P4/16 16 | - [-1, 1, RepNCSPELAN4, [192, 192, 96, 3]] # 6 17 | - [-1, 1, AConv, [256]] # 7-P5/32 18 | - [-1, 1, RepNCSPELAN4, [256, 256, 128, 3]] # 8 19 | - [-1, 1, SPPELAN, [256, 128]] # 9 20 | 21 | head: 22 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 23 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 24 | - [-1, 1, RepNCSPELAN4, [192, 192, 96, 3]] # 12 25 | 26 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 27 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 28 | - [-1, 1, RepNCSPELAN4, [128, 128, 64, 3]] # 15 29 | 30 | - [-1, 1, AConv, [96]] 31 | - [[-1, 12], 1, Concat, [1]] # cat head P4 32 | - [-1, 1, RepNCSPELAN4, [192, 192, 96, 3]] # 18 (P4/16-medium) 33 | 34 | - [-1, 1, AConv, [128]] 35 | - [[-1, 9], 1, Concat, [1]] # cat head P5 36 | - [-1, 1, RepNCSPELAN4, [256, 256, 128, 3]] # 21 (P5/32-large) 37 | 38 | - [[15, 18, 21], 1, Detect, [nc]] # Detect(P3, P4 P5) 39 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/models/v9/yolov9t.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # YOLOv9t object detection model. For Usage examples see https://docs.ultralytics.com/models/yolov9 3 | # 917 layers, 2128720 parameters, 8.5 GFLOPs 4 | 5 | # Parameters 6 | nc: 80 # number of classes 7 | 8 | # GELAN backbone 9 | backbone: 10 | - [-1, 1, Conv, [16, 3, 2]] # 0-P1/2 11 | - [-1, 1, Conv, [32, 3, 2]] # 1-P2/4 12 | - [-1, 1, ELAN1, [32, 32, 16]] # 2 13 | - [-1, 1, AConv, [64]] # 3-P3/8 14 | - [-1, 1, RepNCSPELAN4, [64, 64, 32, 3]] # 4 15 | - [-1, 1, AConv, [96]] # 5-P4/16 16 | - [-1, 1, RepNCSPELAN4, [96, 96, 48, 3]] # 6 17 | - [-1, 1, AConv, [128]] # 7-P5/32 18 | - [-1, 1, RepNCSPELAN4, [128, 128, 64, 3]] # 8 19 | - [-1, 1, SPPELAN, [128, 64]] # 9 20 | 21 | head: 22 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 23 | - [[-1, 6], 1, Concat, [1]] # cat backbone P4 24 | - [-1, 1, RepNCSPELAN4, [96, 96, 48, 3]] # 12 25 | 26 | - [-1, 1, nn.Upsample, [None, 2, "nearest"]] 27 | - [[-1, 4], 1, Concat, [1]] # cat backbone P3 28 | - [-1, 1, RepNCSPELAN4, [64, 64, 32, 3]] # 15 29 | 30 | - [-1, 1, AConv, [48]] 31 | - [[-1, 12], 1, Concat, [1]] # cat head P4 32 | - [-1, 1, RepNCSPELAN4, [96, 96, 48, 3]] # 18 (P4/16-medium) 33 | 34 | - [-1, 1, AConv, [64]] 35 | - [[-1, 9], 1, Concat, [1]] # cat head P5 36 | - [-1, 1, RepNCSPELAN4, [128, 128, 64, 3]] # 21 (P5/32-large) 37 | 38 | - [[15, 18, 21], 1, Detect, [nc]] # Detect(P3, P4, P5) 39 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/test.py: -------------------------------------------------------------------------------- 1 | import yaml 2 | import sys 3 | yaml_file = "/home/easyits/ang/computer_vision-11-14/ultralytics/cfg_yaml/default.yaml" 4 | def load_config_from_yaml(yaml_file): 5 | """从 YAML 文件加载配置""" 6 | with open(yaml_file, 'r', encoding='utf-8') as f: 7 | config = yaml.safe_load(f) 8 | return config 9 | 10 | 11 | config = load_config_from_yaml(yaml_file) -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/trackers/botsort.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # Default YOLO tracker settings for BoT-SORT tracker https://github.com/NirAharon/BoT-SORT 3 | 4 | tracker_type: botsort # tracker type, ['botsort', 'bytetrack'] 5 | track_high_thresh: 0.5 # threshold for the first association 6 | track_low_thresh: 0.1 # threshold for the second association 7 | new_track_thresh: 0.6 # threshold for init new track if the detection does not match any tracks 8 | track_buffer: 30 # buffer to calculate the time when to remove tracks 9 | match_thresh: 0.8 # threshold for matching tracks 10 | # min_box_area: 10 # threshold for min box areas(for tracker evaluation, not used for now) 11 | # mot20: False # for tracker evaluation(not used for now) 12 | 13 | # BoT-SORT settings 14 | gmc_method: sparseOptFlow # method of global motion compensation 15 | # ReID model related thresh (not supported yet) 16 | proximity_thresh: 0.5 17 | appearance_thresh: 0.25 18 | with_reid: False 19 | -------------------------------------------------------------------------------- /ultralytics/cfg_yaml/trackers/bytetrack.yaml: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | # Default YOLO tracker settings for ByteTrack tracker https://github.com/ifzhang/ByteTrack 3 | 4 | tracker_type: bytetrack # tracker type, ['botsort', 'bytetrack'] 5 | track_high_thresh: 0.5 # threshold for the first association 6 | track_low_thresh: 0.1 # threshold for the second association 7 | new_track_thresh: 0.6 # threshold for init new track if the detection does not match any tracks 8 | track_buffer: 30 # buffer to calculate the time when to remove tracks 9 | match_thresh: 0.8 # threshold for matching tracks 10 | # min_box_area: 10 # threshold for min box areas(for tracker evaluation, not used for now) 11 | # mot20: False # for tracker evaluation(not used for now) 12 | -------------------------------------------------------------------------------- /ultralytics/data/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from .base import BaseDataset 4 | from .build import build_dataloader, build_grounding, build_yolo_dataset, load_inference_source 5 | from .dataset import ( 6 | ClassificationDataset, 7 | GroundingDataset, 8 | SemanticDataset, 9 | YOLOConcatDataset, 10 | YOLODataset, 11 | YOLOMultiModalDataset, 12 | ) 13 | 14 | __all__ = ( 15 | "BaseDataset", 16 | "ClassificationDataset", 17 | "SemanticDataset", 18 | "YOLODataset", 19 | "YOLOMultiModalDataset", 20 | "YOLOConcatDataset", 21 | "GroundingDataset", 22 | "build_yolo_dataset", 23 | "build_grounding", 24 | "build_dataloader", 25 | "load_inference_source", 26 | ) 27 | -------------------------------------------------------------------------------- /ultralytics/data/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/data/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/data/__pycache__/augment.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/data/__pycache__/augment.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/data/__pycache__/base.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/data/__pycache__/base.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/data/__pycache__/build.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/data/__pycache__/build.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/data/__pycache__/converter.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/data/__pycache__/converter.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/data/__pycache__/dataset.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/data/__pycache__/dataset.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/data/__pycache__/loaders.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/data/__pycache__/loaders.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/data/__pycache__/utils.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/data/__pycache__/utils.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/data/explorer/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from .utils import plot_query_result 4 | 5 | __all__ = ["plot_query_result"] 6 | -------------------------------------------------------------------------------- /ultralytics/data/explorer/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/data/explorer/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/data/explorer/__pycache__/explorer.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/data/explorer/__pycache__/explorer.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/data/explorer/__pycache__/utils.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/data/explorer/__pycache__/utils.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/data/explorer/gui/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | -------------------------------------------------------------------------------- /ultralytics/data/scripts/download_weights.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Ultralytics YOLO 🚀, AGPL-3.0 license 3 | # Download latest models from https://github.com/ultralytics/assets/releases 4 | # Example usage: bash ultralytics/data/scripts/download_weights.sh 5 | # parent 6 | # └── weights 7 | # ├── yolov8n.pt ← downloads here 8 | # ├── yolov8s.pt 9 | # └── ... 10 | 11 | python - < w - threshold, 2] = w # x2 24 | boxes[boxes[:, 3] > h - threshold, 3] = h # y2 25 | return boxes 26 | -------------------------------------------------------------------------------- /ultralytics/models/nas/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from .model import NAS 4 | from .predict import NASPredictor 5 | from .val import NASValidator 6 | 7 | __all__ = "NASPredictor", "NASValidator", "NAS" 8 | -------------------------------------------------------------------------------- /ultralytics/models/nas/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/nas/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/nas/__pycache__/model.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/nas/__pycache__/model.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/nas/__pycache__/predict.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/nas/__pycache__/predict.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/nas/__pycache__/val.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/nas/__pycache__/val.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/nas/val.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | import torch 4 | 5 | from ultralytics.models.yolo.detect import DetectionValidator 6 | from ultralytics.utils import ops 7 | 8 | __all__ = ["NASValidator"] 9 | 10 | 11 | class NASValidator(DetectionValidator): 12 | """ 13 | Ultralytics YOLO NAS Validator for object detection. 14 | 15 | Extends `DetectionValidator` from the Ultralytics models package and is designed to post-process the raw predictions 16 | generated by YOLO NAS models. It performs non-maximum suppression to remove overlapping and low-confidence boxes, 17 | ultimately producing the final predn. 18 | 19 | Attributes: 20 | args (Namespace): Namespace containing various configurations for post-processing, such as confidence and IoU. 21 | lb (torch.Tensor): Optional tensor for multilabel NMS. 22 | 23 | Example: 24 | ```python 25 | from ultralytics import NAS 26 | 27 | model = NAS('yolo_nas_s') 28 | validator = model.validator 29 | # Assumes that raw_preds are available 30 | final_preds = validator.postprocess(raw_preds) 31 | ``` 32 | 33 | Note: 34 | This class is generally not instantiated directly but is used internally within the `NAS` class. 35 | """ 36 | 37 | def postprocess(self, preds_in): 38 | """Apply Non-maximum suppression to prediction outputs.""" 39 | boxes = ops.xyxy2xywh(preds_in[0][0]) 40 | preds = torch.cat((boxes, preds_in[0][1]), -1).permute(0, 2, 1) 41 | return ops.non_max_suppression( 42 | preds, 43 | self.args.conf, 44 | self.args.NMS_Threshold, 45 | labels=self.lb, 46 | multi_label=False, 47 | agnostic=self.args.single_cls, 48 | max_det=self.args.max_det, 49 | max_time_img=0.5, 50 | ) 51 | -------------------------------------------------------------------------------- /ultralytics/models/rtdetr/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from .model import RTDETR 4 | from .predict import RTDETRPredictor 5 | from .val import RTDETRValidator 6 | 7 | __all__ = "RTDETRPredictor", "RTDETRValidator", "RTDETR" 8 | -------------------------------------------------------------------------------- /ultralytics/models/rtdetr/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/rtdetr/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/rtdetr/__pycache__/model.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/rtdetr/__pycache__/model.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/rtdetr/__pycache__/predict.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/rtdetr/__pycache__/predict.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/rtdetr/__pycache__/train.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/rtdetr/__pycache__/train.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/rtdetr/__pycache__/val.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/rtdetr/__pycache__/val.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/rtdetr/model.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | """ 3 | Interface for Baidu's RT-DETR, a Vision Transformer-based real-time object detector. RT-DETR offers real-time 4 | performance and high accuracy, excelling in accelerated backends like CUDA with TensorRT. It features an efficient 5 | hybrid encoder and IoU-aware query selection for enhanced detection accuracy. 6 | 7 | For more information on RT-DETR, visit: https://arxiv.org/pdf/2304.08069.pdf 8 | """ 9 | 10 | from ultralytics.engine.project import BaseProject 11 | from ultralytics.nn.tasks import RTDETRDetectionModel 12 | 13 | from .predict import RTDETRPredictor 14 | from .train import RTDETRTrainer 15 | from .val import RTDETRValidator 16 | 17 | 18 | class RTDETR(BaseProject): 19 | 20 | def __init__(self, model_name="rtdetr-l.pt") -> None: 21 | 22 | super().__init__(model_name=model_name, task="detect") 23 | 24 | @property 25 | def task_map(self) -> dict: 26 | """ 27 | Returns a task map for RT-DETR, associating tasks with corresponding Ultralytics classes. 28 | 29 | Returns: 30 | dict: A dictionary mapping task names to Ultralytics task classes for the RT-DETR model. 31 | """ 32 | return { 33 | "detect": { 34 | "predictor": RTDETRPredictor, 35 | "validator": RTDETRValidator, 36 | "trainer": RTDETRTrainer, 37 | "model": RTDETRDetectionModel, 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ultralytics/models/sam/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license 2 | 3 | from .model import SAM 4 | from .predict import Predictor, SAM2Predictor, SAM2VideoPredictor 5 | 6 | __all__ = "SAM", "Predictor", "SAM2Predictor", "SAM2VideoPredictor" # tuple or list 7 | -------------------------------------------------------------------------------- /ultralytics/models/sam/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/sam/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/sam/__pycache__/amg.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/sam/__pycache__/amg.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/sam/__pycache__/build.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/sam/__pycache__/build.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/sam/__pycache__/model.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/sam/__pycache__/model.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/sam/__pycache__/predict.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/sam/__pycache__/predict.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/sam/modules/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | -------------------------------------------------------------------------------- /ultralytics/models/sam/modules/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/sam/modules/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/sam/modules/__pycache__/blocks.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/sam/modules/__pycache__/blocks.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/sam/modules/__pycache__/decoders.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/sam/modules/__pycache__/decoders.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/sam/modules/__pycache__/encoders.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/sam/modules/__pycache__/encoders.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/sam/modules/__pycache__/memory_attention.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/sam/modules/__pycache__/memory_attention.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/sam/modules/__pycache__/sam.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/sam/modules/__pycache__/sam.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/sam/modules/__pycache__/tiny_encoder.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/sam/modules/__pycache__/tiny_encoder.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/sam/modules/__pycache__/transformer.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/sam/modules/__pycache__/transformer.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/sam/modules/__pycache__/utils.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/sam/modules/__pycache__/utils.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | -------------------------------------------------------------------------------- /ultralytics/models/yolo/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from ultralytics.models.yolo import classify, detect, obb, pose, segment, world 4 | 5 | from .projects import YOLO, YOLOWorld 6 | 7 | __all__ = "classify", "segment", "detect", "pose", "obb", "world", "YOLO", "YOLOWorld" 8 | -------------------------------------------------------------------------------- /ultralytics/models/yolo/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/__pycache__/projects.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/__pycache__/projects.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/classify/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from ultralytics.models.yolo.classify.predict import ClassificationPredictor 4 | from ultralytics.models.yolo.classify.train import ClassificationTrainer 5 | from ultralytics.models.yolo.classify.val import ClassificationValidator 6 | 7 | __all__ = "ClassificationPredictor", "ClassificationTrainer", "ClassificationValidator" 8 | -------------------------------------------------------------------------------- /ultralytics/models/yolo/classify/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/classify/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/classify/__pycache__/predict.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/classify/__pycache__/predict.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/classify/__pycache__/train.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/classify/__pycache__/train.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/classify/__pycache__/val.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/classify/__pycache__/val.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/detect/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from .predict import DetectionPredictor 4 | from .train import DetectionTrainer 5 | from .val import DetectionValidator 6 | 7 | __all__ = "DetectionPredictor", "DetectionTrainer", "DetectionValidator" 8 | -------------------------------------------------------------------------------- /ultralytics/models/yolo/detect/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/detect/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/detect/__pycache__/predict.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/detect/__pycache__/predict.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/detect/__pycache__/train.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/detect/__pycache__/train.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/detect/__pycache__/val.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/detect/__pycache__/val.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/detect/predict.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from ultralytics.engine.predictor import BasePredictor 4 | from ultralytics.engine.results import Results 5 | from ultralytics.utils import ops 6 | 7 | 8 | class DetectionPredictor(BasePredictor): #使用基础预测者进行初始化操作 9 | """ 10 | A class extending the BasePredictor class for prediction based on a detection model. 11 | 12 | Example: 13 | ```python 14 | from ultralytics.utils import ASSETS 15 | from ultralytics.models.yolo.detect import DetectionPredictor 16 | 17 | args = dict(model='yolov8n.pt', source=ASSETS) 18 | predictor = DetectionPredictor(overrides=args) 19 | predictor.predict_cli() 20 | ``` 21 | """ 22 | 23 | def postprocess(self, preds, img, orig_imgs): 24 | """Post-processes predictions and returns a list of Results objects.""" 25 | preds = ops.non_max_suppression( #[torch.Size([5, 6])] 26 | preds, 27 | self.args.conf, #置信度 28 | self.args.NMS_Threshold, #iou 29 | agnostic=self.args.agnostic_nms, #false 30 | max_det=self.args.max_det, #最大检测数目 31 | classes=self.args.classes, 32 | ) #torch.Size([6, 6]) 33 | 34 | if not isinstance(orig_imgs, list): # input images are a torch.Tensor, not a list 35 | orig_imgs = ops.convert_torch2numpy_batch(orig_imgs) 36 | 37 | results = [] 38 | for i, pred in enumerate(preds): 39 | orig_img = orig_imgs[i] 40 | pred[:, :4] = ops.scale_boxes(img.shape[2:], pred[:, :4], orig_img.shape) #点 类别 置信度 41 | img_path = self.batch[0][i] 42 | results.append(Results(orig_img, path=img_path, names=self.model.names, boxes=pred)) 43 | return results 44 | -------------------------------------------------------------------------------- /ultralytics/models/yolo/learn.txt: -------------------------------------------------------------------------------- 1 | 改名 model.py 为projects.py -------------------------------------------------------------------------------- /ultralytics/models/yolo/obb/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from .predict import OBBPredictor 4 | from .train import OBBTrainer 5 | from .val import OBBValidator 6 | 7 | __all__ = "OBBPredictor", "OBBTrainer", "OBBValidator" 8 | -------------------------------------------------------------------------------- /ultralytics/models/yolo/obb/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/obb/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/obb/__pycache__/predict.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/obb/__pycache__/predict.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/obb/__pycache__/train.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/obb/__pycache__/train.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/obb/__pycache__/val.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/obb/__pycache__/val.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/obb/train.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from copy import copy 4 | 5 | from ultralytics.models import yolo 6 | from ultralytics.nn.tasks import OBBModel 7 | from ultralytics.utils import DEFAULT_CFG, RANK 8 | 9 | 10 | class OBBTrainer(yolo.detect.DetectionTrainer): 11 | """ 12 | A class extending the DetectionTrainer class for training based on an Oriented Bounding Box (OBB) model. 13 | 14 | Example: 15 | ```python 16 | from ultralytics.models.yolo.obb import OBBTrainer 17 | 18 | args = dict(model='yolov8n-obb.pt', data='dota8.yaml', epochs=3) 19 | trainer = OBBTrainer(overrides=args) 20 | trainer.train() 21 | ``` 22 | """ 23 | 24 | def __init__(self, cfg=DEFAULT_CFG, overrides=None, _callbacks=None): 25 | """Initialize a OBBTrainer object with given arguments.""" 26 | if overrides is None: 27 | overrides = {} 28 | overrides["task"] = "obb" 29 | super().__init__(cfg, overrides, _callbacks) 30 | 31 | def get_model(self, cfg=None, weights=None, verbose=True): 32 | """Return OBBModel initialized with specified config and weights.""" 33 | 34 | ch = self.data_dict["ch"] if "ch" in self.data_dict else 3 35 | model = OBBModel(cfg, ch=ch, nc=self.data["nc"], verbose=verbose and RANK == -1) 36 | if weights: 37 | model.load(weights) 38 | 39 | return model 40 | 41 | def _get_loss_names_validator(self): 42 | """Return an instance of OBBValidator for validation of YOLO model.""" 43 | self.loss_names = "box_loss", "cls_loss", "dfl_loss" 44 | return yolo.obb.OBBValidator(self.test_loader, save_dir=self.save_dir, args=copy(self.args)) 45 | -------------------------------------------------------------------------------- /ultralytics/models/yolo/pose/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from .predict import PosePredictor 4 | from .train import PoseTrainer 5 | from .val import PoseValidator 6 | 7 | __all__ = "PoseTrainer", "PoseValidator", "PosePredictor" 8 | -------------------------------------------------------------------------------- /ultralytics/models/yolo/pose/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/pose/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/pose/__pycache__/predict.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/pose/__pycache__/predict.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/pose/__pycache__/train.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/pose/__pycache__/train.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/pose/__pycache__/val.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/pose/__pycache__/val.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/segment/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from .predict import SegmentationPredictor 4 | from .train import SegmentationTrainer 5 | from .val import SegmentationValidator 6 | 7 | __all__ = "SegmentationPredictor", "SegmentationTrainer", "SegmentationValidator" 8 | -------------------------------------------------------------------------------- /ultralytics/models/yolo/segment/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/segment/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/segment/__pycache__/predict.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/segment/__pycache__/predict.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/segment/__pycache__/train.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/segment/__pycache__/train.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/segment/__pycache__/val.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/segment/__pycache__/val.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/world/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from .train import WorldTrainer 4 | 5 | __all__ = ["WorldTrainer"] 6 | -------------------------------------------------------------------------------- /ultralytics/models/yolo/world/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/world/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/models/yolo/world/__pycache__/train.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/models/yolo/world/__pycache__/train.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/nn/__pycache__/autobackend.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/nn/__pycache__/autobackend.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/nn/__pycache__/tasks.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/nn/__pycache__/tasks.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/nn/extra_modules/YOLOv8_AM.py: -------------------------------------------------------------------------------- 1 | 2 | import torch 3 | import torch.nn as nn 4 | from ultralytics.nn.modules import Conv 5 | 6 | __all__ = ( 7 | "ECAAttention", 8 | ) 9 | 10 | class ECAAttention(nn.Module): 11 | """Constructs a ECA module. 12 | Args: 13 | channel: Number of channels of the input feature map 14 | k_size: Adaptive selection of kernel size 15 | """ 16 | 17 | def __init__(self, c1, k_size=3): 18 | super(ECAAttention, self).__init__() 19 | self.avg_pool = nn.AdaptiveAvgPool2d(1) 20 | self.conv = nn.Conv1d(1, 1, kernel_size=k_size, padding=(k_size - 1) // 2, bias=False) 21 | self.sigmoid = nn.Sigmoid() 22 | 23 | def forward(self, x): 24 | # feature descriptor on the global spatial information 25 | y = self.avg_pool(x) 26 | y = self.conv(y.squeeze(-1).transpose(-1, -2)).transpose(-1, -2).unsqueeze(-1) 27 | # Multi-scale information fusion 28 | y = self.sigmoid(y) 29 | 30 | return x * y.expand_as(x) -------------------------------------------------------------------------------- /ultralytics/nn/extra_modules/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from .ALSS_YOLO import * 4 | from .ALSS2_YOLO import * 5 | from .YOLOv8_AM import * 6 | from .CE_RetinaNet import * -------------------------------------------------------------------------------- /ultralytics/nn/extra_modules/__pycache__/ALSS2_YOLO.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/nn/extra_modules/__pycache__/ALSS2_YOLO.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/nn/extra_modules/__pycache__/ALSS_YOLO.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/nn/extra_modules/__pycache__/ALSS_YOLO.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/nn/extra_modules/__pycache__/CE_RetinaNet.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/nn/extra_modules/__pycache__/CE_RetinaNet.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/nn/extra_modules/__pycache__/YOLOv8_AM.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/nn/extra_modules/__pycache__/YOLOv8_AM.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/nn/extra_modules/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/nn/extra_modules/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/nn/modules/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/nn/modules/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/nn/modules/__pycache__/block.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/nn/modules/__pycache__/block.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/nn/modules/__pycache__/conv.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/nn/modules/__pycache__/conv.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/nn/modules/__pycache__/head.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/nn/modules/__pycache__/head.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/nn/modules/__pycache__/transformer.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/nn/modules/__pycache__/transformer.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/nn/modules/__pycache__/utils.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/nn/modules/__pycache__/utils.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/solutions/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from .ai_gym import AIGym 4 | from .analytics import Analytics 5 | from .distance_calculation import DistanceCalculation 6 | from .heatmap import Heatmap 7 | from .object_counter import ObjectCounter 8 | from .parking_management import ParkingManagement, ParkingPtsSelection 9 | from .queue_management import QueueManager 10 | from .speed_estimation import SpeedEstimator 11 | from .streamlit_inference import inference 12 | 13 | __all__ = ( 14 | "AIGym", 15 | "DistanceCalculation", 16 | "Heatmap", 17 | "ObjectCounter", 18 | "ParkingManagement", 19 | "ParkingPtsSelection", 20 | "QueueManager", 21 | "SpeedEstimator", 22 | "Analytics", 23 | ) 24 | -------------------------------------------------------------------------------- /ultralytics/trackers/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from .bot_sort import BOTSORT 4 | from .byte_tracker import BYTETracker 5 | from .track import register_tracker 6 | 7 | __all__ = "register_tracker", "BOTSORT", "BYTETracker" # allow simpler import 8 | -------------------------------------------------------------------------------- /ultralytics/trackers/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | -------------------------------------------------------------------------------- /ultralytics/utils/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/__pycache__/autobatch.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/__pycache__/autobatch.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/__pycache__/checks.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/__pycache__/checks.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/__pycache__/dist.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/__pycache__/dist.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/__pycache__/downloads.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/__pycache__/downloads.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/__pycache__/errors.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/__pycache__/errors.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/__pycache__/files.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/__pycache__/files.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/__pycache__/instance.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/__pycache__/instance.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/__pycache__/loss.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/__pycache__/loss.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/__pycache__/metrics.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/__pycache__/metrics.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/__pycache__/ops.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/__pycache__/ops.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/__pycache__/patches.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/__pycache__/patches.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/__pycache__/plotting.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/__pycache__/plotting.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/__pycache__/tal.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/__pycache__/tal.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/__pycache__/torch_utils.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/__pycache__/torch_utils.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/callbacks/__init__.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from .base import add_integration_callbacks, default_callbacks, get_default_callbacks 4 | 5 | __all__ = "add_integration_callbacks", "default_callbacks", "get_default_callbacks" 6 | -------------------------------------------------------------------------------- /ultralytics/utils/callbacks/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/callbacks/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/callbacks/__pycache__/base.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/callbacks/__pycache__/base.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/callbacks/__pycache__/clearml.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/callbacks/__pycache__/clearml.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/callbacks/__pycache__/comet.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/callbacks/__pycache__/comet.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/callbacks/__pycache__/dvc.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/callbacks/__pycache__/dvc.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/callbacks/__pycache__/hub.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/callbacks/__pycache__/hub.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/callbacks/__pycache__/mlflow.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/callbacks/__pycache__/mlflow.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/callbacks/__pycache__/neptune.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/callbacks/__pycache__/neptune.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/callbacks/__pycache__/raytune.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/callbacks/__pycache__/raytune.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/callbacks/__pycache__/tensorboard.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/callbacks/__pycache__/tensorboard.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/callbacks/__pycache__/wb.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/helloworlder8/computer_vision/a1f04a129e09947da1208578e45c0bcd73e90f2d/ultralytics/utils/callbacks/__pycache__/wb.cpython-310.pyc -------------------------------------------------------------------------------- /ultralytics/utils/callbacks/raytune.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from ultralytics.utils import SETTINGS 4 | 5 | try: 6 | assert SETTINGS["raytune"] is True # verify integration is enabled 7 | import ray 8 | from ray import tune 9 | from ray.air import session 10 | 11 | except (ImportError, AssertionError): 12 | tune = None 13 | 14 | 15 | def on_fit_epoch_end(trainer): 16 | """Sends training metrics to Ray Tune at end of each current_epoch.""" 17 | if ray.train._internal.session.get_session(): # check if Ray Tune session is active 18 | metrics = trainer.metrics 19 | session.report({**metrics, **{"epoch": trainer.epoch + 1}}) 20 | 21 | 22 | callbacks = ( 23 | { 24 | "on_fit_epoch_end": on_fit_epoch_end, 25 | } 26 | if tune 27 | else {} 28 | ) 29 | -------------------------------------------------------------------------------- /ultralytics/utils/errors.py: -------------------------------------------------------------------------------- 1 | # Ultralytics YOLO 🚀, AGPL-3.0 license 2 | 3 | from ultralytics.utils import emojis 4 | 5 | 6 | class HUBModelError(Exception): 7 | """ 8 | Custom exception class for handling errors related to model fetching in Ultralytics YOLO. 9 | 10 | This exception is raised when a requested model is not found or cannot be retrieved. 11 | The message is also processed to include emojis for better user experience. 12 | 13 | Attributes: 14 | message (str): The error message displayed when the exception is raised. 15 | 16 | Note: 17 | The message is automatically processed through the 'emojis' function from the 'ultralytics.utils' package. 18 | """ 19 | 20 | def __init__(self, message="Model not found. Please check model URL and try again."): 21 | """Create an exception for when a model is not found.""" 22 | super().__init__(emojis(message)) 23 | --------------------------------------------------------------------------------