Skip to main content

HED-Tensor: Holistic Edge Detection

A TensorFlow/Keras implementation of Holistically-Nested Edge Detection (HED) with pretrained weights included. Use it as easily as VGG16 or ResNet!

🚀 Quick Start

Installation

pip install hed-tensor

Usage (3 lines!)

from hed_tensor import HED, detect_edges

model = HED()  # Weights automatically load!
edges = detect_edges('your_image.jpg', model=model)

That's it! No need to download weights separately. 🎉

📦 Features

✅ Pretrained weights included - No extra downloads needed
✅ Simple API - Just like using VGG16 or ResNet
✅ Multiple input formats - Works with file paths, PIL Images, or NumPy arrays
✅ Batch processing - Process multiple images efficiently
✅ TensorFlow 2.x - Modern and fast

🎯 Examples

Basic Usage

from hed_tensor import HED, detect_edges
from PIL import Image

# Load model (weights auto-load)
model = HED()

# Detect edges
edges = detect_edges('image.jpg', model=model)

# Save result
Image.fromarray(edges).save('edges.png')

Using NumPy arrays

import numpy as np
from hed_tensor import HED, detect_edges

model = HED()
image_array = np.array(Image.open('image.jpg'))
edges = detect_edges(image_array, model=model)

Batch Processing

from hed_tensor import batch_detect_edges, HED

model = HED()
image_paths = ['img1.jpg', 'img2.jpg', 'img3.jpg']

edge_maps = batch_detect_edges(
    image_paths, 
    model=model, 
    output_dir='output_edges'
)

Load Custom Weights

# Use your own trained weights
model = HED(weights='path/to/your/checkpoint.h5')

# Or skip loading weights
model = HED(weights=None)

📋 Requirements

  • Python >= 3.7
  • TensorFlow >= 2.4.0
  • NumPy >= 1.19.0
  • Pillow >= 8.0.0

🎓 Citation

If you use this package in your research, please cite the original HED paper:

@inproceedings{xie2015holistically,
  title={Holistically-nested edge detection},
  author={Xie, Saining and Tu, Zhuowen},
  booktitle={Proceedings of the IEEE International Conference on Computer Vision},
  pages={1395--1403},
  year={2015}
}

📄 License

MIT License

👨‍💻 Author

Mohammad Saad Nathani
📧 saadnathani2005@gmail.com

🤝 Contributing

Contributions are welcome!


Made with ❤️ for the Computer Vision community

Metadata

Release files for hed-tensor 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hed-tensor 1.0.1
File Size Uploaded
hed_tensor-1.0.1.tar.gz 54.7 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for hed-tensor 1.0.1
File Interpreter ABI Platform
hed_tensor-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 109.5 MB

Release files / hed_tensor-1.0.1.tar.gz

Download URL hed_tensor-1.0.1.tar.gz
Size 54.7 MB
Tags Source
SHA-256 checksum
How to use checksums
c65344372b17a23bd7db1d4bd2b311bf60c489d04a8fc33b4790070466d74553
BLAKE2b-256 checksum
How to use checksums
751f49e01c4fa9cc0431546d5bf7a2d0104d6173941ab2fca3e6c6023ab0d1ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / hed_tensor-1.0.1-py3-none-any.whl

Download URL hed_tensor-1.0.1-py3-none-any.whl
Size 54.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
73537777d814695e929348a7a5732ca90ff32d32bf88e68e1c848befdec4b66d
BLAKE2b-256 checksum
How to use checksums
af57127d3ceb099e90937ee43ca96aa94290ccede62792aa13bf36ea53dd657c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page