last try for real
Browse files
script.py
CHANGED
@@ -117,6 +117,7 @@ class ImageDataset(Dataset):
|
|
117 |
|
118 |
def __getitem__(self, idx):
|
119 |
image_path = os.path.join(self.local_filepath, self.filepaths[idx])
|
|
|
120 |
|
121 |
image = cv2.imread(image_path)
|
122 |
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
@@ -158,7 +159,7 @@ def generate_embeddings(metadata_file_path, root_dir):
|
|
158 |
|
159 |
test_dataset = ImageDataset(metadata_df, local_filepath=root_dir)
|
160 |
|
161 |
-
loader = DataLoader(test_dataset, batch_size=1, shuffle=False
|
162 |
|
163 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
164 |
model = timm.create_model(
|
@@ -335,8 +336,7 @@ def make_submission(metadata_df):
|
|
335 |
{w: ckpt["model." + w] for w in model.state_dict().keys()}
|
336 |
)
|
337 |
model.eval()
|
338 |
-
|
339 |
-
|
340 |
models.append(model)
|
341 |
|
342 |
fungi_model = FungiEnsembleModel(models)
|
@@ -396,3 +396,7 @@ if __name__ == "__main__":
|
|
396 |
metadata_df = generate_embeddings(metadata_file_path, root_dir)
|
397 |
|
398 |
make_submission(metadata_df)
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
def __getitem__(self, idx):
|
119 |
image_path = os.path.join(self.local_filepath, self.filepaths[idx])
|
120 |
+
# print("Reading from ", image_path)
|
121 |
|
122 |
image = cv2.imread(image_path)
|
123 |
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
|
|
159 |
|
160 |
test_dataset = ImageDataset(metadata_df, local_filepath=root_dir)
|
161 |
|
162 |
+
loader = DataLoader(test_dataset, batch_size=1, shuffle=False)
|
163 |
|
164 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
165 |
model = timm.create_model(
|
|
|
336 |
{w: ckpt["model." + w] for w in model.state_dict().keys()}
|
337 |
)
|
338 |
model.eval()
|
339 |
+
|
|
|
340 |
models.append(model)
|
341 |
|
342 |
fungi_model = FungiEnsembleModel(models)
|
|
|
396 |
metadata_df = generate_embeddings(metadata_file_path, root_dir)
|
397 |
|
398 |
make_submission(metadata_df)
|
399 |
+
|
400 |
+
|
401 |
+
|
402 |
+
|