Open monajalal opened 6 years ago
There really should no issue on the call of format(directory) as this is the string the loop iterates over. as the code in main() is:
def main():
# Read a .mat file and convert it to a pascal format
for directory in ['train','eval']:
if not os.path.exists('data/{}/annotations/xml'.format(directory)):
os.makedirs('data/{}/annotations/xml'.format(directory))
MAT_FILES_PATH = os.path.join(os.getcwd(), 'data/{}/annotations/mat'.format(directory))
XML_FILES_PATH = os.path.join(os.getcwd(), 'data/{}/annotations/xml'.format(directory))
IMG_FILES_PATH = os.path.join(os.getcwd(), 'data/{}/images'.format(directory))
# List all files in the MAT_FILES_PATH and ignore hidden files (.DS_STORE for Macs)
mat_files = [[join(MAT_FILES_PATH, x), x] for x in os.listdir(MAT_FILES_PATH) if isfile(join(MAT_FILES_PATH, x)) and x[0] is not '.']
mat_files.sort()
# Iterate through all files and convert them to XML
for mat_file in mat_files:
#print(mat_file)
read_mat_file(mat_file[0], mat_file[1],IMG_FILES_PATH, XML_FILES_PATH)
#break
print ("successfully converted {}-labels from mat to pascal-xml").format(directory)
cv2.destroyAllWindows()
My questions:
@monajalal you are facing this issue because in the last print the syntax is wrong for python 3. It is written like this print ("successfully converted {}-labels from mat to pascal-xml").format(directory) but should actually be print ("successfully converted {}-labels from mat to pascal-xml".format(directory)) I hope this helps.
Hey when I ran mat_to_xml.py I got this error:
how should this be fixed?