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

About cityscapes Datasets #120

Open
small-beebee opened this issue Nov 8, 2020 · 2 comments
Open

About cityscapes Datasets #120

small-beebee opened this issue Nov 8, 2020 · 2 comments

Comments

@small-beebee
Copy link

How to get the datasets/cityscapes/train_fine.txt and datasets/cityscapes/val_fine.txt?

@rstrudel
Copy link

rstrudel commented Dec 14, 2020

Hi,
Thanks a lot for providing such a good repository. I have been using it to load several segmentation datasets successfully.
I have currently the same problem with Cityscapes. I extracted the zip files with your prepare_cityscapes.py script and followed cityscapes preparation steps i.e. I run createTrainIdLabelImgs.py after modification. I am still missing the two files mentioned by @small-beebee . What should I do?

@small-beebee did you solve it ?

@Eileen000
Copy link

try:
import glob

def make_txtfile(num, mode=None):

i = 0
# for the DANET the txt filename
if mode == "train" or "val":
    txt_name = mode+"_fine"
else:
    txt_name = mode

imgs = glob.glob("/drive/MyDrive/DANet-master/datasets/cityscapes/leftImg8bit/"+ mode + "/*/*.png")
with open("/drive/MyDrive/DANet-master/datasets/cityscapes/"+ txt_name +".txt", "w") as f:
    for path in imgs:
        path = path[48:] # delete "./datasets/cityscapes/"
        print(path+'/n')
        data = path + "\t" + path.replace("leftImg8bit", "gtFine").replace("gtFine.png", "gtFine_labelTrainIds.png") + "\n"
        f.write(data)
        i +=1
        if i == num:
            break
print('write the ', "/drive/MyDrive/DANet-master/datasets/cityscapes/"+ mode+".txt")

if name == 'main':

  train_num = 2975
  val_num =500
  test_num =1525

  make_txtfile(train_num, mode='train')
  make_txtfile(val_num, mode='val')
  make_txtfile(test_num, mode='test')

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

No branches or pull requests

3 participants