MCPcopy Create free account
hub / github.com/InternRobotics/G2VLM / __init__

Method __init__

eval_code/recons/datasets/eth3d.py:20–53  ·  view source on GitHub ↗
(
        self,
        ETH3D_DIR: str,
        load_img_size: int = 518,
        cache_file: str = "data/dataset_cache/eth3d_mv_recon_cache.npy",
    )

Source from the content-addressed store, hash-verified

18
19class ETH3D(Dataset):
20 def __init__(
21 self,
22 ETH3D_DIR: str,
23 load_img_size: int = 518,
24 cache_file: str = "data/dataset_cache/eth3d_mv_recon_cache.npy",
25 ):
26
27 self.ETH3D_DIR = ETH3D_DIR
28 if ETH3D_DIR == None:
29 raise NotImplementedError
30 print(f"ETH3D_DIR is {ETH3D_DIR}")
31
32 if osp.exists(cache_file):
33 print(f"[ETH3D] Loading from cache file: {cache_file}")
34 self.metadata = np.load(cache_file, allow_pickle=True).item()
35 self.sequence_list = sorted(self.metadata.keys())
36 else:
37 print(f"[ETH3D] Cache file not found, loading from {ETH3D_DIR}")
38
39 self.sequence_list = [seq for seq in os.listdir(ETH3D_DIR) if os.path.isdir(osp.join(ETH3D_DIR, seq))]
40 self.sequence_list = sorted(self.sequence_list)
41
42 self.metadata = {}
43 for seq in self.sequence_list:
44 seq_image_root = osp.join(ETH3D_DIR, seq, 'images', 'custom_undistorted')
45 image_list = [imgname for imgname in os.listdir(seq_image_root) if imgname.endswith('.JPG')]
46 image_list = sorted(image_list)
47
48 self.metadata[seq] = image_list
49
50 np.save(cache_file, self.metadata)
51
52 self.load_img_size = load_img_size
53 print(f"[ETH3D] Data size: {len(self)}")
54
55 def __len__(self):
56 return len(self.sequence_list)

Callers

nothing calls this directly

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected