--- license: apache-2.0 base_model: convnext_tiny_in22k tags: - medical - healthcare - image-classification - brain-tumor-detection datasets: - medical-images language: - en library_name: transformers pipeline_tag: image-classification --- # Brain Tumor Detection ## Model Description This model is a ConvNeXt Tiny architecture trained with FastAI for detecting brain tumors in MRI scans. It can classify brain MRI images as either showing signs of a tumor or being normal (no tumor detected). Note: This model uses FastAI format and requires specific loading procedures. ## Intended Uses & Limitations ⚠️ **Important**: This model is for research and educational purposes only. It should **NOT** be used for actual medical diagnosis without proper clinical validation and oversight by qualified medical professionals. ### Intended Uses - Research and development in medical AI - Educational purposes for learning about medical image classification - Proof-of-concept applications with proper disclaimers - Academic studies and benchmarking ### Limitations - Not clinically validated - Should not replace professional medical diagnosis - May have biases based on training data - Performance may vary on different populations or imaging conditions ## Model Details - **Model Type**: Image Classification - **Architecture**: convnext_tiny_in22k - **Classes**: 2 - **Input**: RGB images (224x224 pixels) ### Classes - No Tumor - Tumor Detected ## Usage ```python from transformers import AutoModelForImageClassification, AutoImageProcessor from PIL import Image import torch # Load model and processor model = AutoModelForImageClassification.from_pretrained("your-username/brain-tumor-detection") processor = AutoImageProcessor.from_pretrained("your-username/brain-tumor-detection") # Load and process image image = Image.open("path_to_image.jpg") inputs = processor(image, return_tensors="pt") # Make prediction with torch.no_grad(): outputs = model(**inputs) predicted_class_id = outputs.logits.argmax().item() predicted_class = model.config.id2label[predicted_class_id] print(f"Predicted class: {predicted_class}") ``` ## Training Details This model was fine-tuned from pre-trained vision transformers on medical image datasets. For detailed training information, please refer to the original model documentation. ## Evaluation The model has been tested on held-out validation sets with the reported accuracy metrics. However, clinical evaluation and validation are required before any medical application. ## Ethical Considerations - Medical AI models can have significant impact on human health - Proper validation and regulatory approval required for clinical use - Potential for bias in training data and model predictions - Should be used responsibly with appropriate medical oversight ## Contact For questions about this model, please create an issue in the repository. ## Citation If you use this model in your research, please cite appropriately and acknowledge that it's for research purposes only. ## FastAI Usage This model uses FastAI format. To use it: ```python from fastai.vision.all import load_learner import pathlib import platform # Fix for cross-platform compatibility if platform.system() == 'Windows': pathlib.PosixPath = pathlib.WindowsPath # Load the model model = load_learner('model.pkl') # Make prediction prediction, pred_idx, probs = model.predict(image) print(f"Prediction: {prediction}") ``` ## Requirements - fastai<2.8.0 - torch<2.7 - timm - pathlib (for cross-platform compatibility)