Resource retrieval
Get the pre-trained net:
Evaluation function
Write an evaluation function to post-process the net output in order to obtain keypoint position, strength and features:
Basic usage
Obtain the keypoints of a given image:
Visualize the keypoints:
Specify a maximum of 15 keypoints and visualize the new detection:
Network result
For the default input size of 224⨯224, the net divides the input image in 55⨯55 patches and computes a feature vector of size 512 for each patch:
Every patch is associated to a scalar strength value indicating the likelihood that the patch contains a keypoint. The strength of each patch is the maximal element of its feature vector after an L2 normalization. Obtain the strength of each patch:
Visualize the strength of each patch as a heat map:
Overlay the heat map on the image:
Keypoints are selected starting from the patch with highest strength, up to keypoints. Highlight the top 10 keypoints:
Find correspondences between images
The main application of computing feature vectors for the image keypoints is to find correspondences in different images of the same scene. Get two hundred keypoint features from two images:
Define a function to find the n nearest pairs of keypoints (in feature space) and use it to find the five nearest pairs:
Get the keypoint positions associated with each pair and visualize them on the respective images:
Net information
Inspect the number of parameters of all arrays in the net:
Obtain the total number of parameters:
Obtain the layer type counts:
Display the summary graphic:
Export to ONNX
Export the net to the ONNX format:
Get the size of the ONNX file:
The byte count of the resource object is similar to the ONNX file:
Check some metadata of the ONNX model:
Import the model back into the Wolfram Language. However, the NetEncoder and NetDecoder will be absent because they are not supported by ONNX: