CASIA-IVA-Lab / AnomalyGPT

[AAAI 2024 Oral] AnomalyGPT: Detecting Industrial Anomalies Using Large Vision-Language Models
https://anomalygpt.github.io
Other
807 stars 100 forks source link

代码在数据预处理模块中好像一开始就读入全部图像,占用较大内存,好像没必要吧?? #65

Closed plshuaishuai2 closed 9 months ago

plshuaishuai2 commented 9 months ago

代码在数据预处理模块中好像存在一些错误:1.一开始就读入全部图像,占用较大内存!问题在mvtec.py里面: with open(datas_csv_path, 'r') as file: reader = csv.reader(file)

        for row in tqdm(reader):
            if row[1] == 'train' and row[0] in CLASS_NAMES:
                file_path = os.path.join(root_dir, row[3])
                self.paths.append(file_path)
                self.x.append(self.transform(Image.open(file_path).convert('RGB')))

这部分self.x 没必要吧,应该在getitem中调用吧??????

FantasticGNU commented 9 months ago

这样可以省去后面从硬盘读数据的时间,相当于用空间换时间,内存不够的话可以移到 getitem 里面,都可以的