DeepCrack
DeepCrack copied to clipboard
how to generator "*_example.txt"
Hi, thanks for your job. Could you please the script for generating 'example.txt' file? I cannot understand the content in .txt file. Thanks in advance.
Thanks for your question. In the val_example.txt file, each raw has two images, where the first one is the image for test, and the second one is the ground truth. We may remove this file later. You can create your own test file.
Thanks. But I mean could you please provide the script for generating the txt file? Actually, I cannot understand the logic in the val_example.txt, where the test image is end with .jpg and the gt image is is .png. I don't find the png gt image, but instead .bmp file. I am so confused about the process of generation, and could you please give an example script for our usage? Many thanks.
The .png and the .bmp contain the same content, i.e., the crack ground truth. The jpg is generally a loss compression format for images that would bring uncerntainty for crack masks. So for all the ground-truth images, we use lossless format, e.g., bmp and png. In creating your own training dataset, you can use both bmp format or png format. It would be very easy to write the script in python to organize your own data into the list file.
I have writen a simple python code , you can use it with your data @ChunmianLin
import os
base_dir = 'D:\\test\\deepcrack\\DeepCrack-master\\codes\\data'
train_image_dir = os.path.join(base_dir, 'CrackLS315')
train_mask_dir = os.path.join(base_dir, 'CrackLS315_gt')
imageList=[]
maskList=[]
train_image_fnames = os.listdir(train_image_dir)
for name in train_image_fnames:
imageList.append(train_image_dir+'\\'+name)
train_mask_fnames = os.listdir(train_mask_dir)
for name in train_mask_fnames:
maskList.append(train_mask_dir+'\\'+name)
textfile = open("D:\\test\\deepcrack\\DeepCrack-master\\train_example.txt", "w")
for im,mas in zip(imageList,maskList):
textfile.write(im+' '+mas + "\n")
textfile.close()
Thanks @mindmad