Practical overview
When it fits
Use Hardnet when a computer-vision workflow needs learned descriptors for image patches and you can supply patches in the format expected by its examples. It also fits experiments that compare or train local descriptors.
Who it is for
- Computer-vision developers building image-matching or image-retrieval pipelines.
- Researchers comparing or training learned local image descriptors.
Documented uses
- Extract local feature descriptors from grayscale image patches.
- Use pretrained weights as descriptor features in an image-matching application.
- Train a descriptor model with the repository's scripts and datasets.
- Convert the PyTorch model to TorchScript for use from C++ code.
Requirements & limits
The public repository specifies an MIT license.
- The extraction examples expect grayscale patches arranged in HPatches format, not arbitrary image inputs.
- The README recommends different pretrained weights for practical use, Liberty Brown comparisons, and a model not trained on HPatches.
- The BoW retrieval engine mentioned in the README is proprietary and is not included in the repository.
- The README lists Python 2.7, OpenCV and additional requirements for its training workflow.
- The README points to a CTU in Prague mirror because PhotoTour's original dataset links are no longer available.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Extract descriptors from HPatches-format patches
Use the repository's example script to write Hardnet descriptors for an input patch image.
Before you start
- Python 2.7, OpenCV and additional packages listed in requirements.txt.
- A grayscale input image in HPatches format: width equals patch size and height equals patch count multiplied by patch size.
- A copy of the Hardnet repository and a pretrained model from its pretrained folder.
Steps
Change to the examples directory.
Run the documented extraction script with an input image and output filename: python extract_hardnet_desc_from_hpatches_file.py imgs/ref.png out.txt.
Expected outcome
The example writes extracted patch descriptors to the specified output file.
Guide limitations
- The documented input format is HPatches-style grayscale patch layout; other formats are not described.
- The README lists Python 2.7 and the required libraries; it does not provide a compatibility guarantee for other environments.
Set up the documented Hardnet training workflow
Prepare the repository's training workflow and direct it to download datasets and start learning a descriptor.
Before you start
- Python 2.7, OpenCV and additional packages listed in requirements.txt.
- The Hardnet repository and datasets used by its training script.
Steps
Clone the repository with git clone https://github.com/DagnyT/hardnet.
Run ./code/run_me.sh to download datasets and start learning the descriptor.
Expected outcome
The README says training logs are stored in TensorBoard format in the logs/ directory.
Guide limitations
- The README notes that PhotoTour's original dataset links are no longer available and points to a CTU in Prague mirror.
- The guide describes the README's setup and invocation steps, not a verified run.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 15 October 2026
- Original website title
- DagnyT/hardnet · Official homepage title · retained in its source language

