Missing eventsam_list.txt
Closed this issue · 2 comments
Bin1119 commented
Sorry, I did not find eventsam_list.txt in the RGBE-SAM dataset you provided, causing the dataloder to run incorrectly. I wonder if this file is missing from the dataset you provided? Can you help with that? Thank you very much.
class RGBEData(Dataset):
def __init__(self, root):
self.root = root
self.data_paths = [line.rstrip() for line in open(os.path.join(self.root, 'eventsam_list.txt'))]
print('The size of data is %d' % (len(self.data_paths)))
self.image_pixel_mean = torch.Tensor([0.485,0.456,0.406]).view(-1, 1, 1)
self.image_pixel_std = torch.Tensor([0.229,0.224,0.225]).view(-1, 1, 1)
self.evimg_pixel_mean = torch.Tensor([0.485,0.456,0.406]).view(-1, 1, 1)
self.evimg_pixel_std = torch.Tensor([0.229,0.224,0.225]).view(-1, 1, 1)
dianzizs commented
Hello, I've encountered the same issue. Have you found the corresponding list? The existing lists in this repo seem to have only one column, which doesn't conform to the format required by the loader.
Bin1119 commented
Hello, I've encountered the same issue. Have you found the corresponding list? The existing lists in this repo seem to have only one column, which doesn't conform to the format required by the loader.
You can try the code below.
import os
folder_path = '/workspace/shared/event_dataset/EventSAM/Datasets/RGBE-SEG/train'
folders = [os.path.join(folder_path, item) for item in os.listdir(folder_path) if os.path.isdir(os.path.join(folder_path, item))]
with open('eventsam_list.txt', 'w') as file:
for folder in folders:
rgb_folder = os.path.join(folder, 'rgb_image')
event_folder = os.path.join(folder, 'event')
print(rgb_folder, ' ', event_folder)
rgb_files = set([os.path.splitext(file)[0] for file in os.listdir(rgb_folder)])
event_files = set([os.path.splitext(file)[0] for file in os.listdir(event_folder)])
print(rgb_files, ' ', event_files)
common_filenames = rgb_files.intersection(event_files)
for filename in common_filenames:
rgb_filename = filename + '.jpg'
event_filename = filename + '.npz'
file.write(os.path.join(rgb_folder, rgb_filename) + ' ' + os.path.join(event_folder, event_filename) + '\n')