add code
This commit is contained in:
parent
58fa893d4d
commit
c8f2babd76
8 changed files with 300 additions and 7 deletions
18
Code/dataset_new.py
Normal file
18
Code/dataset_new.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
import torch
|
||||
from torch.utils.data import Dataset
|
||||
import numpy as np
|
||||
|
||||
class ImagesWithSaliency(Dataset):
|
||||
def __init__(self, npy_path, dtype=None):
|
||||
self.dtype = dtype
|
||||
self.datas = np.load(npy_path, allow_pickle = True)
|
||||
|
||||
def __len__(self):
|
||||
return len(self.datas)
|
||||
|
||||
def __getitem__(self, idx):
|
||||
if self.dtype:
|
||||
self.datas[idx][0] = self.datas[idx][0].type(self.dtype)
|
||||
self.datas[idx][3] = self.datas[idx][3].type(self.dtype)
|
||||
|
||||
return self.datas[idx]
|
Loading…
Add table
Add a link
Reference in a new issue