pointnet-pytorch icon indicating copy to clipboard operation
pointnet-pytorch copied to clipboard

missing txt file s3d_cat2num.txt

Open MyoungHaSong opened this issue 6 years ago • 4 comments

how can I get this text file ?

Can you give me an example if I have to make it myself?

MyoungHaSong avatar Oct 03 '19 13:10 MyoungHaSong

Hi, actually you can generate this file yourself quite easily, after you downloaded the S3DIS dataset, you iterate the folder names (i.e. categories) under Area 1 - 6 and create a dict mapping each category to an integer. There should be around 40 categories if I recall correctly.

yunxiaoshi avatar Oct 18 '19 15:10 yunxiaoshi

Hi, actually you can generate this file yourself quite easily, after you downloaded the S3DIS dataset, you iterate the folder names (i.e. categories) under Area 1 - 6 and create a dict mapping each category to an integer. There should be around 40 categories if I recall correctly.

Hi, @kentsyx ,can you show more details about how to genarate this text file,I still can't get it,thx!

shadowoflight1 avatar Dec 04 '19 02:12 shadowoflight1

@shadowoflight1 I agree too.. @kentsyx I'm not sure yet, can you explain it in more detail? Or can you share the file you created?

MyoungHaSong avatar Dec 09 '19 05:12 MyoungHaSong

I wrote a gen_s3d_cat2num.py as follows that solves the problem. Don't feel like to PR so if @kentsyx you like you could add that to your project.

import os


def main():
    cats = set()
    data_root = "Stanford3dDataset_v1.2_Aligned_Version"

    for _set in ["train", "test"]:
        area_list = os.listdir(os.path.join(data_root, _set))
        for _area in area_list:
            category_list = os.listdir(os.path.join(data_root, _set, _area))
            for category in category_list:
                if category.split('_')[0] == ".DS":
                    continue
                for cat in os.listdir(os.path.join(data_root, _set, _area, category, "Annotations")):
                    cats.add(cat.split('_')[0])

    cats.remove(".DS")
    # print(cats)
    f = open(data_root + "/s3d_cat2num.txt", "w+")
    for i, cat in enumerate(cats):
        f.write("%s %d\n" % (cat, i))
    f.close()

if __name__ == "__main__":
    main()

EnJiang avatar Jun 12 '20 04:06 EnJiang