--- license: mit tags: - image-classification - biology - microscopy - resnet datasets: - custom metrics: - accuracy - f1 model-index: - name: resnet18 results: - task: type: image-classification metrics: - name: Accuracy type: accuracy value: 0.965 - name: F1 type: f1 value: 0.97 --- # resnet18 Binary classifier for detecting cancer cell presence on micropatterns in phase contrast microscopy images. ## Model description Fine-tuned ResNet-18 (`microsoft/resnet-18`) that classifies 77x77 pixel grayscale crops as **present** (cancer cell on micropattern) or **absent** (empty micropattern). Part of the pipeline for analyzing T-cell killing assays. ## Training - **Base model**: `microsoft/resnet-18` - **Dataset**: 420 manually annotated samples (28 crops x 15 timepoints) from a single position (Pos150) - **Class balance**: 60% present / 40% absent - **Epochs**: 20 - **Batch size**: 32 - **Learning rate**: 1e-4 - **Validation split**: 20% - **Training time**: ~45 seconds on Apple Silicon ## Performance | Metric | Value | |--------|-------| | Accuracy | 96.5% | | F1 Score | 0.97 | ### Control validation (Pos140, no T-cells added) - 47/53 cells correctly classified as surviving all 50 timepoints - 6 false deaths (~11% false positive death rate) ## Usage ```python from transformers import AutoImageProcessor, AutoModelForImageClassification from PIL import Image processor = AutoImageProcessor.from_pretrained("keejkrej/resnet18") model = AutoModelForImageClassification.from_pretrained("keejkrej/resnet18") image = Image.open("crop.png").convert("RGB") inputs = processor(image, return_tensors="pt") outputs = model(**inputs) predicted_class = outputs.logits.argmax(-1).item() label = model.config.id2label[predicted_class] # "present" or "absent" ``` ## Input format - 77x77 pixel grayscale microscopy crops (uint16 normalized to uint8) - Converted to RGB (3-channel) before processing - Single micropattern site per crop ## Labels | ID | Label | |----|-------| | 0 | absent | | 1 | present |