Ir para o conteúdo
ModelListadosExterno
Baixar

ChestNet

This model is a custom image classifier built with PyTorch, leveraging a pretrained DenseNet121 backbone. The model extracts rich visual features from the pretrained weights and uses a custom classification head to...

TipoOtherModelo basegalactixx/Torchvision-DenseNet121-a639ec97VersãoRevision 1f73fd9

Fonte do modelo

Tipo
Other
Tamanho do arquivo
27,2 MB
Modelo base
galactixx/Torchvision-DenseNet121-a639ec97
Versão
vRevision 1f73fd9
Atualizado
17 de set. de 2026
Downloads
0
Fonte
Hugging Face

Descrição da fonte

DenseNet121 Image Classifier

This model is a custom image classifier built with PyTorch, leveraging a pretrained DenseNet121 backbone. The model extracts rich visual features from the pretrained weights and uses a custom classification head to predict the target categories.

Model Details

  • Developed by: [Aditya chaubey]
  • Model type: Image Classification (Convolutional Neural Network)
  • Architecture: DenseNet121 (Dense Convolutional Network)
  • Library: PyTorch
  • License: Mit
  • Pretrained Backbone: torchvision.models.densenet121

Intended Uses & Limitations

Intended Uses

  • Automated classification of images into [14] categories.
  • Fine-tuning or feature extraction for related computer vision tasks.

Limitations & Bias

  • Image Resolution: The backbone expects standard image sizes (typically 322x322 pixels). Performance may degrade on highly distorted or low-resolution images.
  • Domain Bias: The model inherits the features learned from ImageNet. It may perform poorly on highly niche domains (e.g., specific medical imaging or satellite data) unless heavily fine-tuned on target data.

How to Get Started with the Model

You can load and run inference with this model directly using standard PyTorch tools.

First, ensure you have the huggingface_hub, torch, and torchvision libraries installed:

pip install torch torchvision huggingface_hub pillow

Use the snippet below to download the model weights and run a prediction:

import torch
import torchvision.models as models
import torchvision.transforms as transforms
from PIL import Image
from huggingface_hub import hf_hub_download

# 1. Recreate the model architecture
model = models.densenet121(weights=None)  # Initialize architecture

# Replace the final classifier head to match your custom number of classes
# Example: num_classes = 10 (Change this to your actual number of classes)
num_classes = 10 
model.classifier = torch.nn.Linear(model.classifier.in_features, num_classes)

# 2. Download and load the weights from Hugging Face Hub
# Replace 'your-username/your-model-name' with your repository ID
checkpoint_path = hf_hub_download(repo_id="adityachaubey/ChestNet", filename="model.pt")
model.load_state_dict(torch.load(checkpoint_path, map_location=torch.device('cpu')))
model.eval()

# 3. Prepare the input image
transform = transforms.Compose([
    transforms.Resize(256),
    transforms.CenterCrop(224),
    transforms.ToTensor(),
    transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])

image = Image.open("path_to_your_image.jpg").convert("RGB")
input_tensor = transform(image).unsqueeze(0)  # Add batch dimension

# 4. Run inference
with torch.no_grad():
    outputs = model(input_tensor)
    probabilities = torch.nn.functional.softmax(outputs[0], dim=0)
    predicted_class = torch.argmax(probabilities).item()

print(f"Predicted Class Index: {predicted_class}")

Training Details

Training Data

The model was fine-tuned on the [NIH-Chest-X-ray-dataste] dataset, which contains [112,120] images across [14] classes.

Data Preprocessing

Images were resized, cropped to 224x224, and normalized using standard ImageNet mean and standard deviation values:

  • Mean: [0.485, 0.456, 0.406]
  • Std: [0.229, 0.224, 0.225]

Training Hyperparameters

  • Optimizer: [Adam]
  • Learning Rate: [1e-5]
  • Batch Size: [e.g., 32]
  • Epochs: [10]

Evaluation Results

The model achieved the following performance metrics on the validation/test set:

  • Accuracy: [83%]
  • Loss: [Insert validation loss]

Fontes

1 fonte
Hugging FacePrimárioVersão 1f73fd90ef392ec68bd1e53c5e817484ed1956a1
huggingface.co/adityachaubey/ChestNet/tree/1f73fd90ef392ec68bd1e53c5e817484ed1956a1

Verificado 17 de set.

Artefatos de modelo

1 artefato

ChesNet_v5.pth

pth · 27,2 MB · SHA-256 c936de362af6…7736 · Hugging Face

Baixar

Trechos de fonte

2 trechos

--- license: mit datasets: - alkzar90/NIH-Chest-X-ray-dataset language: - en metrics: - roc_auc base_model: - galactixx/Torchvision-DenseNet121-a639ec97 pipeline_tag: image-classification tags: - Ai - fine-tuned - image-classification --- # DenseNet121 Image Classifier This model is a custom image classifier built with **PyTorch**, leveraging a pretrained **DenseNet121** backbone. The model extracts rich visual features from the pretrained weights and uses a custom classification head to predict the target categories. ## Model Details - **Developed by:** [Aditya chaubey] - **Model type:** Image Classification (Convolutional Neural Network) - **Architecture:** DenseNet121 (Dense Convolutional Network) - **Library:** PyTorch - **License:** Mit - **Pretrained Backbone:** torchvision.models.densenet121 ## Intended Uses & Limitations ### Intended Uses - Automated classification of images into [14] categories. - Fine-tuning or feature extraction for related computer vision tasks. ### Limitations & Bias - **Image Resolution:** The backbone expects standard image sizes (typically 322x322 pixels). Performance may degrade on highly distorted or low-resolution images. - **Domain Bias:** The model inherits the features learned from ImageNet. It may perform poorly on highly niche domains (e.g., specific medical imaging or satellite data) unless heavily fine-tuned on target data. ## How to Get Started with the Model You can load and run inference with this model directly using standard PyTorch tools. First, ensure you have the `huggingface_hub`, `torch`, and `torchvision` libraries installed: ```bash pip install torch torchvision huggingface_hub pillow ``` Use the snippet below to download the model weights and run a prediction: ```python import torch import torchvision.models as models import torchvision.transforms as transforms from PIL import Image from huggingface_hub import hf_hub_download # 1. Recreate the model architecture model = models.densenet121(weights=None) # Initialize architecture # Replace the final classifier head to match your custom number of classes # Example: num_classes = 10 (Change this to your actual number of classes) num_classes = 10 model.classifier = torch.nn.Linear(model.classifier.in_features, num_classes) # 2. Download and load the weights from Hugging Face Hub # Replace 'your-username/your-model-name' with your repository...

Source context: 0 downloads · 2 likes · Pipeline image-classification · Repo adityachaubey/ChestNet