File size: 1,137 Bytes
5f0437a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""
Created by Myung-Joon Kwon
mjkwon2021@gmail.com
27 Jan 2021

modified by Fabrizio Guillaro
fabrizio.guillaro@unina.it
September 2022
"""

from project_config import project_root, dataset_paths
from dataset.AbstractDataset import AbstractDataset
import os

class compRAISE(AbstractDataset):
    """
    directory structure
    compRAISE
    β”œβ”€β”€ r000da54ft_Q67.jpg
    β”œβ”€β”€ r000da54ft_Q67_aligned_Q87.jpg
    └── r000da54ft_Q67_resize_1.15_Q90.jpg ...
    """
    def __init__(self, crop_size, grid_crop, img_list: str, max_dim=None, aug=None):
        super().__init__(crop_size, grid_crop, max_dim, aug=aug)
        self._root_path = dataset_paths['compRAISE']
        with open(project_root / img_list, "r") as f:
            lines = f.readlines()            
        self.img_list = [t.strip() for t in lines]
        

    def get_img(self, index):
        assert 0 <= index < len(self.img_list), f"Index {index} is not available!"
        rgb_path = os.path.join(self._root_path, self.img_list[index])
        assert os.path.isfile(rgb_path)
        return self._create_tensor(mask=None, rgb_path=rgb_path)