--- license: apache-2.0 pipeline_tag: image-classification tags: - model_hub_mixin - pytorch_model_hub_mixin - medical-imaging - cervical-cancer - pap-smear - pytorch - alexnet --- # AlexNet Fine-Tuned on HERLEV Dataset This repository contains a fine-tuned **AlexNet** model trained on the **HERLEV cervical cytology dataset** for multi-class classification of Pap smear images. The model was uploaded using the **PyTorchModelHubMixin**, enabling native Hugging Face loading via `from_pretrained`. --- ## Model Details - **Architecture:** AlexNet - **Framework:** PyTorch - **Input size:** 224 × 224 RGB - **Number of classes:** 7 - **Task:** Cervical cell image classification --- ## Classes | Label | Cell Type | |------|-----------| | 0 | Superficial Squamous | | 1 | Intermediate Squamous | | 2 | Columnar | | 3 | Mild Dysplasia | | 4 | Moderate Dysplasia | | 5 | Severe Dysplasia | | 6 | Carcinoma in situ | --- ## How to Use ### Installation ```bash pip install torch torchvision huggingface_hub pillow ``` --- ## Load the Model ```python import torch from huggingface_hub import PyTorchModelHubMixin from torchvision import transforms from PIL import Image from model import AlexNetHERLEV model = AlexNetHERLEV.from_pretrained( "hp1318/alexnet-finetuned-herlev" ) model.eval() ``` --- ## Image Preprocessing ```python transform = transforms.Compose([ transforms.Resize((224, 224)), transforms.ToTensor(), transforms.Normalize( mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225] ) ]) ``` --- ## Run Inference ```python image = Image.open("cell_image.jpg").convert("RGB") image = transform(image).unsqueeze(0) with torch.no_grad(): outputs = model(image) prediction = torch.argmax(outputs, dim=1) print("Predicted class:", prediction.item()) ``` --- ## Output The model outputs logits for all cervical cell classes. The predicted label corresponds to the class with the highest logit score. --- ## Notes - Input images must be RGB format. - Images are resized to 224 × 224 before inference. - Normalization follows ImageNet statistics. - This model is intended for research and educational use only. --- ## Citation If you use this model in academic work, please cite the corresponding paper or repository.