Update app.py
Browse files
app.py
CHANGED
|
@@ -590,7 +590,7 @@ transform = transforms.Compose([
|
|
| 590 |
transforms.ToTensor(),
|
| 591 |
])
|
| 592 |
|
| 593 |
-
dataset = datasets.ImageFolder(root='Datasets/Bananas', transform=transform)
|
| 594 |
|
| 595 |
# Create a DataLoader
|
| 596 |
loader = DataLoader(dataset, batch_size=32, shuffle=False)
|
|
@@ -626,7 +626,7 @@ transform = transforms.Compose([
|
|
| 626 |
transforms.Normalize(mean=mean, std=std)
|
| 627 |
])
|
| 628 |
|
| 629 |
-
test_dataset = datasets.ImageFolder(root='
|
| 630 |
|
| 631 |
# Extracting features from Efficientnet model
|
| 632 |
def extract_features(test_dataset):
|
|
@@ -691,7 +691,6 @@ print(f"Covariance Matrix Shape: {covariance_matrix.shape}")
|
|
| 691 |
|
| 692 |
# Defining the function to calculate the Mahalanobis distance
|
| 693 |
|
| 694 |
-
import torch
|
| 695 |
|
| 696 |
def mahalanobis(x=None, feature_mean=None, feature_cov=None):
|
| 697 |
"""Compute the Mahalanobis Distance between each row of x and the data
|
|
|
|
| 590 |
transforms.ToTensor(),
|
| 591 |
])
|
| 592 |
|
| 593 |
+
dataset = datasets.ImageFolder(root='Datasets/Bananas/Dataset', transform=transform)
|
| 594 |
|
| 595 |
# Create a DataLoader
|
| 596 |
loader = DataLoader(dataset, batch_size=32, shuffle=False)
|
|
|
|
| 626 |
transforms.Normalize(mean=mean, std=std)
|
| 627 |
])
|
| 628 |
|
| 629 |
+
test_dataset = datasets.ImageFolder(root='Datasets/Bananas/Dataset', transform=transform)
|
| 630 |
|
| 631 |
# Extracting features from Efficientnet model
|
| 632 |
def extract_features(test_dataset):
|
|
|
|
| 691 |
|
| 692 |
# Defining the function to calculate the Mahalanobis distance
|
| 693 |
|
|
|
|
| 694 |
|
| 695 |
def mahalanobis(x=None, feature_mean=None, feature_cov=None):
|
| 696 |
"""Compute the Mahalanobis Distance between each row of x and the data
|