DeepCrack icon indicating copy to clipboard operation
DeepCrack copied to clipboard

how to generator "*_example.txt"

Open linchunmian opened this issue 3 years ago • 4 comments

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.

linchunmian avatar Aug 30 '20 07:08 linchunmian

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.

qinnzou avatar Sep 06 '20 00:09 qinnzou

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.

linchunmian avatar Sep 07 '20 01:09 linchunmian

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.

qinnzou avatar Sep 09 '20 15:09 qinnzou

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()

mindmad avatar Jul 02 '21 10:07 mindmad

Thanks @mindmad

qinnzou avatar Dec 06 '22 09:12 qinnzou