Instructions to use jerry050512/GLIDE-Net with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sam2
How to use jerry050512/GLIDE-Net with sam2:
# Use SAM2 with images import torch from sam2.sam2_image_predictor import SAM2ImagePredictor predictor = SAM2ImagePredictor.from_pretrained("jerry050512/GLIDE-Net") with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): predictor.set_image(<your_image>) masks, _, _ = predictor.predict(<input_prompts>)# Use SAM2 with videos import torch from sam2.sam2_video_predictor import SAM2VideoPredictor predictor = SAM2VideoPredictor.from_pretrained("jerry050512/GLIDE-Net") with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): state = predictor.init_state(<your_video>) # add new prompts and instantly get the output on the same frame frame_idx, object_ids, masks = predictor.add_new_points(state, <your_prompts>) # propagate the prompts to get masklets throughout the video for frame_idx, object_ids, masks in predictor.propagate_in_video(state): ... - Notebooks
- Google Colab
- Kaggle
GLIDE-Net
Full PyTorch checkpoint for Global-Local Interaction and Detail Enhancement Network for RGB-D Rail Surface Defect Detection.
Code and installation instructions: Jerry050512/GLIDE-Net.
Model
GLIDE-Net uses a Transformer–CNN hybrid encoder with a frozen SAM2 Hiera-L backbone and trainable adapters, Cross-Modal Fusion (CMF), and a Multi-Scale Detail Enhancement and Fusion (MSDEF) decoder.
glide_net_6440647.pth contains the complete model state, including the frozen
backbone and batch normalization buffers. It requires no separate SAM2
checkpoint for inference. File size: 968,608,466 bytes.
This is a custom PyTorch model; use the implementation in the linked GitHub
repository to load it.
Download and inference
pip install -U huggingface_hub
hf download jerry050512/GLIDE-Net glide_net_6440647.pth --local-dir checkpoints
git clone https://github.com/Jerry050512/GLIDE-Net.git
cd GLIDE-Net
# Install dependencies as described in the repository README.
python test.py \
--data_path /path/to/NEU-RSDDS-AUG \
--checkpoint /path/to/checkpoints/glide_net_6440647.pth \
--device cpu --cpu_threads 4 --num_workers 0 \
--save_path ./results/pred
python eval.py \
--pred_path ./results/pred \
--gt_path /path/to/NEU-RSDDS-AUG/GT_test
The dataset must contain aligned RGB BMP, depth TIFF and GT PNG files in
Image_test/, Depth_test/ and GT_test/. Use the original dataset inputs,
rather than JPEG/PNG visualization copies. Input resolution is 352×352.
CPU inference is supported; GPU inference is faster.
Results
The original experiment's saved predictions on the 362-image NEU RSDDS-AUG test set yield:
| S-measure | MAE | max-E | max-F |
|---|---|---|---|
| 0.8718 | 0.0501 | 0.9475 | 0.9129 |
max-F uses the maximum of the averaged F-measure curve with beta=0.3; max-E uses the maximum of the averaged E-measure curve. The original experiment used the test split for checkpoint selection.
The checkpoint was selected at epoch 27 and migrated from experiment commit
64406472f9c90dbf30f4ba44115c1e3a62167699 by renaming all 991 state tensors
without changing their values. Three sampled old/release CPU model outputs
matched exactly at all decoder scales. An 85-image CPU check matched historical
prediction metrics at four decimal places; some pixels differed by one uint8
gray level. This is a subset verification, not a full CPU rerun of 362 images.
Intended use and limitations
The model is intended for research on RGB-D rail surface defect segmentation. Performance on other cameras, depth sensors or datasets has not been established. It has not been validated for autonomous safety-critical rail inspection.
License and attribution
Released under Apache-2.0; see LICENSE. The included frozen backbone derives from Meta's SAM2, also Apache-2.0. Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved. Dataset rights remain with the original dataset authors.
The checksum of the uploaded checkpoint is provided in SHA256SUMS.txt.
Formal citation details will be added after publication.
- Downloads last month
- -