in data_loaders.py [0:0]
def __init__(self, classes, args, set_type='train', produce_sheets = False):
# initialization of data locations
self.args = args
self.surf_location = '../data/surfaces/'
self.img_location = '../data/images/'
self.touch_location = '../data/scene_info/'
self.sheet_location = '../data/remake_sheets/'
self.set_type = set_type
self.set_list = np.load('../data/split.npy', allow_pickle='TRUE').item()
self.empty = torch.FloatTensor(np.load('../data/empty_gel.npy'))
self.produce_sheets = produce_sheets
names = [[f.split('/')[-1], f.split('/')[-2]] for f in glob((f'{self.img_location}/*/*'))]
self.names = []
import os
for n in tqdm(names):
if n[1] in classes:
if os.path.exists(self.surf_location + n[1] + '/' + n[0] + '.npy'):
if os.path.exists(self.touch_location + n[1] + '/' + n[0]):
if self.produce_sheets or (n[0] + n[1]) in self.set_list[self.set_type]:
if produce_sheets:
for i in range(5):
for j in range(4):
self.names.append(n + [i, j])
else:
for i in range(5):
hand_info = np.load(f'{self.touch_location}/{n[1]}/{n[0]}/{i}.npy',
allow_pickle=True).item()
for j in range(4):
if hand_info['touch_success'][j]:
self.names.append(n + [i, j])
print(f'The number of {set_type} set objects found : {len(self.names)}')