Pid Line Segmentation Unet Resnet34
This model is a U-Net architecture with a ResNet34 encoder, fine-tuned for P&ID (Piping and Instrumentation Diagram) line segmentation.
Fuente del modelo
- Tipo
- Other
- Tamaño del archivo
- 93,4–280 MB
- Versión
- vRevision e9d2c11
- Actualizado
- 27 sept 2026
- Descargas
- 9
- Tareas
- Segmentación de imágenes
- Fuente
- Hugging Face
Descripción de la fuente
P&ID Line Segmentation Model (U-Net with ResNet34 Backbone)
This model is a U-Net architecture with a ResNet34 encoder, fine-tuned for P&ID (Piping and Instrumentation Diagram) line segmentation.
Model Details
- Architecture: U-Net with
resnet34backbone. - Input size:
1024x1024pixels. - Output: Binary mask (single class for lines).
- Loss Function: Combined Dice Loss and Focal Loss.
Performance (on Test Set)
- Test Loss: 0.5721
- Test Dice Score: 0.9413
- Test IoU Score: 0.8908
Usage
This model can be loaded using segmentation_models_pytorch.
import torch
import segmentation_models_pytorch as smp
from huggingface_hub import hf_hub_download
# Define the model architecture
model = smp.Unet(
encoder_name="resnet34",
encoder_weights=None, # Weights are loaded from the saved state_dict
in_channels=3,
classes=1,
activation="sigmoid"
)
# Download and load state_dict
model_path = hf_hub_download(repo_id="Frimpong1/pid-line-segmentation-unet-resnet34", filename="pytorch_model.bin")
model.load_state_dict(torch.load(model_path, map_location=torch.device('cpu')))
model.eval()
# Example of using the model (assuming you have an image_tensor preprocessed)
# image_tensor = ... # (C, H, W) float32 tensor, normalized
# with torch.no_grad():
# prediction = model(image_tensor.unsqueeze(0)) # Add batch dimension
# mask = (prediction.squeeze(0).cpu().numpy() > 0.5).astype(float)
Training Details
- Epochs Trained: 20
- Batch Size: 4
- Learning Rate: 0.0001
- Optimizer: Adam
License
(Specify your license here, e.g., MIT)
Fuentes
1 fuente
Fuentes
1 fuenteVerificado 27 sept
Artefactos del modelo
2 artefactos
Artefactos del modelo
2 artefactosExtractos de fuentes
2 extractos
Extractos de fuentes
2 extractos--- library_name: transformers tags: - image-segmentation - unet - resnet - pid - computer-vision --- # P&ID Line Segmentation Model (U-Net with ResNet34 Backbone) This model is a U-Net architecture with a ResNet34 encoder, fine-tuned for P&ID (Piping and Instrumentation Diagram) line segmentation. ## Model Details - **Architecture**: U-Net with `resnet34` backbone. - **Input size**: `1024x1024` pixels. - **Output**: Binary mask (single class for lines). - **Loss Function**: Combined Dice Loss and Focal Loss. ## Performance (on Test Set) - **Test Loss**: 0.5721 - **Test Dice Score**: 0.9413 - **Test IoU Score**: 0.8908 ## Usage This model can be loaded using `segmentation_models_pytorch`. ```python import torch import segmentation_models_pytorch as smp from huggingface_hub import hf_hub_download # Define the model architecture model = smp.Unet( encoder_name="resnet34", encoder_weights=None, # Weights are loaded from the saved state_dict in_channels=3, classes=1, activation="sigmoid" ) # Download and load state_dict model_path = hf_hub_download(repo_id="Frimpong1/pid-line-segmentation-unet-resnet34", filename="pytorch_model.bin") model.load_state_dict(torch.load(model_path, map_location=torch.device('cpu'))) model.eval() # Example of using the model (assuming you have an image_tensor preprocessed) # image_tensor = ... # (C, H, W) float32 tensor, normalized # with torch.no_grad(): # prediction = model(image_tensor.unsqueeze(0)) # Add batch dimension # mask = (prediction.squeeze(0).cpu().numpy() > 0.5).astype(float) ``` ## Training Details - **Epochs Trained**: 20 - **Batch Size**: 4 - **Learning Rate**: 0.0001 - **Optimizer**: Adam ## License (Specify your license here, e.g., MIT)
Source context: 9 downloads · 1 likes · Pipeline image-segmentation · Library transformers · Repo Frimpong1/pid-line-segmentation-unet-resnet34
