Neural Architecture Search:使用Ultralytics框架进行YOLO-NAS目标检测
前言
相关介绍
前提条件
实验环境
matplotlib>=3.2.2
numpy>=1.18.5
opencv-python>=4.6.0
Pillow>=7.1.2
PyYAML>=5.3.1
requests>=2.23.0
scipy>=1.4.1
torch>=1.7.0
torchvision>=0.8.1
tqdm>=4.64.0
tensorboard>=2.4.1
pandas>=1.1.4
seaborn>=0.11.0
安装环境
pip install ultralytics
# 或者
pip install ultralytics -i https://pypi.tuna.tsinghua.edu.cn/simple # 国内清华源,下载速度更快
项目地址
Linux
git clone https://github.com/ultralytics/ultralytics.git
Cloning into 'ultralytics'...
remote: Enumerating objects: 4583, done.
remote: Counting objects: 100% (4583/4583), done.
remote: Compressing objects: 100% (1270/1270), done.
remote: Total 4583 (delta 2981), reused 4576 (delta 2979), pack-reused 0
Receiving objects: 100% (4583/4583), 23.95 MiB | 1.55 MiB/s, done.
Resolving deltas: 100% (2981/2981), done.
Windows
使用Ultralytics框架进行YOLO-NAS目标检测
进行预测
python predict.py
from ultralytics import NAS
if __name__=="__main__":
# Load a COCO-pretrained YOLO-NAS-s model
model = NAS("yolo_nas_s.pt")
# Display model information (optional)
model.info()
# Run inference with the YOLO-NAS-s model on the image
results = model("imgs/test.png", save=True)
results[0].show()
进行验证
python val.py
from ultralytics import YOLO
def val():
# Create a YOLO-World model
model = YOLO("yolov8s-world.pt") # or select yolov8m/l-world.pt for different sizes
# Conduct model validation on the COCO8 example dataset
metrics = model.val(data="coco8.yaml", batch=1, imgsz=640, device=0,workers=1)
if __name__=="__main__":
val()
参考文献
[1] Ultralytics 源代码地址:https://github.com/ultralytics/ultralytics.git.
[2] Ultralytics Docs:https://docs.ultralytics.com/
[3] SAM2 官方源代码:https://github.com/facebookresearch/segment-anything-2.git
[4] SAM2 论文地址:https://ai.meta.com/research/publications/sam-2-segment-anything-in-images-and-videos/
[5] https://docs.ultralytics.com/models/sam/
[6] https://docs.ultralytics.com/models/sam-2/
[7] https://segment-anything.com/
[8] https://arxiv.org/abs/2304.02643
[9] Alexander Kirillov, Eric Mintun, Nikhila Ravi, Hanzi Mao, Chloe Rolland, Laura Gustafson, Tete Xiao, Spencer Whitehead, Alexander C. Berg, Wan-Yen Lo, Piotr Dollár, Ross Girshick. Segment Anything. 2023
[10] Nikhila Ravi, Valentin Gabeur, Yuan-Ting Hu, Ronghang Hu, Chay Ryali, Tengyu Ma, Haitham Khedr, Roman Rädle, Chloe Rolland, Laura Gustafson, Eric Mintun,Junting Pan, Kalyan Vasudev Alwala, Nicolas Carion, Chao-Yuan Wu, Ross Girshick,Piotr Dollar, Christoph Feichtenhofer. SAM 2: Segment Anything in Images and Videos. 2024