Venkata Pydipalli commited on
Commit
f52fc33
·
1 Parent(s): be3a73a

README updated with the dataset loding.

Browse files
Files changed (1) hide show
  1. README.md +19 -0
README.md CHANGED
@@ -104,6 +104,25 @@ config_dict = {
104
  # Initialize model
105
  model = PCamClassifier(config_dict)
106
  model.load_state_dict(torch.load('best_enhanced_pcam_model.pt'))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  ```
108
 
109
  ---
 
104
  # Initialize model
105
  model = PCamClassifier(config_dict)
106
  model.load_state_dict(torch.load('best_enhanced_pcam_model.pt'))
107
+
108
+
109
+ class PCamDataset(Dataset):
110
+ def __init__(self, dataset):
111
+ self.dataset = dataset
112
+
113
+ def __len__(self):
114
+ return len(self.dataset)
115
+
116
+ def __getitem__(self, idx):
117
+ example = self.dataset[idx]
118
+ image = example["image"].convert("RGB")
119
+ image_array = np.array(image) / 255.0
120
+ image_array = image_array.transpose(2, 0, 1).astype(np.float32)
121
+ return {
122
+ "pixel_values": image_array,
123
+ "labels": example["label"]
124
+ }
125
+
126
  ```
127
 
128
  ---