英文:
YOLO V8 save results custom file name
问题
我想保存Yolo v8的预测结果。
我知道如何设置路径或项目/名称,但我不想只是任何文件名,例如“image0.jpg”。我想将文件名指定为类似于“custom-name.jpg”的内容。
我想要在目录中的一些图像上进行迭代地检测人体姿势。
model = YOLO("./yolov8x-pose.pt")
for file in os.listdir(dir_path):
img = cv2.imread(file)
results = model(source=img, save=True, project='/../place')
我想要将结果的文件名指定为与原始文件名或类似的内容。
英文:
I want to save the results the prediction of Yolo v8.
I know how so set the path or project/name but I don't want just any file name, e.g. "image0.jpg". I want to specify the file name to something like "custom-name.jpg".
I want to iteratively detect human pose on a number of images from a directory.
model = YOLO("./yolov8x-pose.pt")
for file in os.listdir(dir_path):
img = cv2.imread(file)
results = model(source=img, save=True, project='/../place')
I want to specify the file names of the results in the folder, to either the original file name or something close.
答案1
得分: 1
问题首先是使用cv2读取图像文件img = cv2.imread(file)
。
解决方案:
results = model(source=file, save=True, project='../place')
YOLO将直接读取源文件,并在结果中使用文件名。
英文:
The problem was first reading the image file with cv2 img = cv2.imread(file)
.
Solution:
results = model(source=file, save=True, project='../place')
YOLO will read the source file directly and use the filename in the results.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论