correll's picture
Update datasetbuilder.py
04844bf
raw
history blame contribute delete
878 Bytes
from os import listdir
from datasets import Dataset, Image
import json
import huggingface_hub
huggingface_hub.login('')
all_rgb=listdir('data/rgb')
all_rgb=['data/rgb/' + f for f in all_rgb]
all_d=listdir('data/d')
all_d=['data/d/' + f for f in all_d]
all_mask=listdir('data/mask')
all_mask=['data/mask/' + f for f in all_mask]
all_json =listdir('data/meta')
all_jsons=[]
for jsonfilename in all_json:
with open('data/meta/'+jsonfilename) as json_file:
data = json.load(json_file)
all_jsons.append(data)
ds=Dataset.from_dict({'rgb' : all_rgb,
'depth' : all_d,
'mask' : all_mask,
'meta' : all_jsons}
).cast_column('rgb',Image()).cast_column('depth',Image()).cast_column('mask',Image())
ds.push_to_hub('correll/semanticsegmentationandposeestimationfromrgbd')