Downloads · 30 days
0
alcheung0213/Medmnist_active_learning
Medmnist_active_learning is a image classification model from alcheung0213. Use it when you need a label for an image. The card lists the license as mit.
This model is designed for image classification tasks within the medical imaging domain, specifically targeting the MedMNIST dataset. It employs a ResNet-50 architecture tailored for 28x28 pixel images and incorporate…
Downloads · 30 days
0
Access
Public
Updated Nov 22, 2024
Repo size
377 MB
Likes
0
Public
Click a slice to open those files.
.pt189 MB · 67%
From the Hugging Face model README
This model is designed for image classification tasks within the medical imaging domain, specifically targeting the MedMNIST dataset. It employs a ResNet-50 architecture tailored for 28x28 pixel images and incorporates active learning strategies to enhance performance with limited labeled data.
| Hyperparameter | Value |
|---|---|
| Batch Size | 53 |
| Initial Labeled Size | 3559 |
| Learning Rate | 0.01332344940133225 |
| MC Dropout Passes | 6 |
| Samples to Label | 4430 |
| Weight Decay | 0.00021921795989143406 |
The optimizer used during training was Stochastic Gradient Descent(SDG), with the following settings and a Learning Rate Scheduler of ReduceLROnPlateau:
learning_rate = 0.01332344940133225momentum = 0.9weight_decay = 0.00021921795989143406The model was trained with float32 precision.
The active learning process was based on a mixed sampling strategy:
The model was evaluated on the validation set of PathMNIST. Key performance metrics include:
The following plots illustrates the validation loss, validation accuracy, and validation auc over batches(number of iterations over the dataset) during the active learning process.



All code for this model can be accessed in the following GitHub Repository: Allen Cheung Determined_AI_Hackathon
To utilize this model:
Install Dependencies: Ensure the following Python packages are installed:
torchtorchvisionmedmnistscikit-learndeterminedInstall them using pip:
pip install torch torchvision medmnist scikit-learn determined
Load the Model:
import torch
from model import ResNet50_28
model = ResNet50_28(num_classes=9)
model.load_state_dict(torch.load('pytorch_model.bin'))
model.eval()
Inference:
from torchvision import transforms
from PIL import Image
transform = transforms.Compose([
transforms.Resize((28, 28)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.5], std=[0.5])
])
image = Image.open('path_to_image.jpg')
input_tensor = transform(image).unsqueeze(0)
output = model(input_tensor)
prediction = output.argmax(dim=1).item()
print(f"Predicted class: {prediction}")
This project is licensed under the MIT License.