Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于pascal.py里的annopath #27

Open
mastergao57 opened this issue Apr 11, 2022 · 2 comments
Open

关于pascal.py里的annopath #27

mastergao57 opened this issue Apr 11, 2022 · 2 comments
Labels
question Further information is requested

Comments

@mastergao57
Copy link

作者您好,当我运行到这句代码时self.annopath = os.path.join(VOC_test_root, 'VOC2007', 'Annotations', '{:s}.xml')recs[imagename] = self.parse_record(annopath.format(imagename))总是报错找不到.xml文件,显示路径有错误,不知道您有没有遇到类似的问题。`

@mastergao57
Copy link
Author

mastergao57 commented Apr 11, 2022

import os
import cv2
import json
import math
import pickle
import numpy as np
import xml.etree.ElementTree as ET
VOC_test_root = './data/voc'
apath = os.path.join(VOC_test_root, 'VOC2007', 'Annotations')
annopath = os.path.join(VOC_test_root, 'VOC2007', 'Annotations','{:s}.xml')
print(annopath.format('123456'))
print(apath)

运行这段代码发现使用format会丢失路径,结果如下
123456.xml
./data/voc\VOC2007\Annotations
正常的结果应该是./data/voc\VOC2007\Annotations\123456.xml

@pprp pprp added the question Further information is requested label Apr 18, 2022
@pprp
Copy link
Owner

pprp commented Apr 18, 2022

Thank you for your interest in my project.

From your descriptions above, IMO, maybe this part {:s}.xml didn't work.

You can modify it to: f"{your_variable}.xml"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants