fingerprint_signature_generator

This model was adapted from Image similarity estimation using a Siamese Network with a contrastive loss.

Siamese Networks are neural networks which share weights between two or more sister networks, each producing embedding vectors of its respective inputs.

In supervised similarity learning, the networks are then trained to maximize the contrast (distance) between embeddings of inputs of different classes, while minimizing the distance between embeddings of similar classes, resulting in embedding spaces that reflect the class segmentation of the training inputs.

Refer to the Fingerprint Authentication Tutorial for more details.

Commands

# Do a "dry run" test training of the model
mltk train fingerprint_signature_generator-test

# Train the model
mltk train fingerprint_signature_generator

# Evaluate the trained model .tflite model
mltk evaluate fingerprint_signature_generator --tflite

# Profile the model in the MVP hardware accelerator simulator
mltk profile fingerprint_signature_generator --accelerator MVP

# Profile the model on a physical development board
mltk profile fingerprint_signature_generator --accelerator MVP --device

# Model command to dump the preprocessed dataset
mltk custom fingerprint_signature_generator dump

# Model command to compare the raw vs preprocessed dataset images
mltk custom fingerprint_signature_generator preprocess --count 200

# Run this model in the fingerprint_reader application
mltk fingerprint_reader fingerprint_signature_generator --dump-images

Model Summary

mltk summarize fingerprint_signature_generator --tflite

+-------+-------------------+------------------+-----------------+-------------------------------------------------------+
| Index | OpCode            | Input(s)         | Output(s)       | Config                                                |
+-------+-------------------+------------------+-----------------+-------------------------------------------------------+
| 0     | depthwise_conv_2d | 180x180x1 (int8) | 88x88x8 (int8)  | Multiplier:8 padding:valid stride:2x2 activation:relu |
|       |                   | 5x5x8 (int8)     |                 |                                                       |
|       |                   | 8 (int32)        |                 |                                                       |
| 1     | average_pool_2d   | 88x88x8 (int8)   | 44x44x8 (int8)  | Padding:valid stride:2x2 filter:2x2 activation:none   |
| 2     | conv_2d           | 44x44x8 (int8)   | 42x42x16 (int8) | Padding:valid stride:1x1 activation:relu              |
|       |                   | 3x3x8 (int8)     |                 |                                                       |
|       |                   | 16 (int32)       |                 |                                                       |
| 3     | mean              | 42x42x16 (int8)  | 16 (int8)       | Type=reduceroptions                                   |
|       |                   | 2 (int32)        |                 |                                                       |
| 4     | fully_connected   | 16 (int8)        | 16 (int8)       | Activation:none                                       |
|       |                   | 16 (int8)        |                 |                                                       |
|       |                   | 16 (int32)       |                 |                                                       |
+-------+-------------------+------------------+-----------------+-------------------------------------------------------+
Total MACs: 3.581 M
Total OPs: 7.330 M
Name: fingerprint_signature_generator
Version: 1
Description: Fingerprint "signature" generator estimation using a Siamese Network with a contrastive loss
Classes: match, no-match
hash: c5b17e1deffd907e823bfadf519b2d5d
date: 2022-05-24T22:34:55.383Z
runtime_memory_size: 95964
threshold: 0.18000000715255737
sharpen_filter: b'þýýýþýýýýýýýdýýýýýýýþýýýþ'
sharpen_filter_width: 5
sharpen_filter_height: 5
sharpen_gain: 32
balance_threshold_max: 240
balance_threshold_min: 0
border: 32
verify_imin: 32
verify_imax: 224
verify_full_threshold: 3
verify_center_threshold: 2
samplewise_norm.rescale: 0.0
samplewise_norm.mean_and_std: False
.tflite file size: 6.5kB

Model Profiling Report

# Profile on physical EFR32xG24 using MVP accelerator
mltk profile fingerprint_signature_generator --device --accelerator MVP

 Profiling Summary
 Name: fingerprint_signature_generator
 Accelerator: MVP
 Input Shape: 1x180x180x1
 Input Data Type: int8
 Output Shape: 1x16
 Output Data Type: int8
 Flash, Model File Size (bytes): 6.4k
 RAM, Runtime Memory Size (bytes): 143.0k
 Operation Count: 7.5M
 Multiply-Accumulate Count: 3.6M
 Layer Count: 5
 Unsupported Layer Count: 0
 Accelerator Cycle Count: 4.1M
 CPU Cycle Count: 5.4M
 CPU Utilization (%): 57.4
 Clock Rate (hz): 78.0M
 Time (s): 119.7m
 Ops/s: 62.7M
 MACs/s: 29.8M
 Inference/s: 8.4

 Model Layers
 +-------+-------------------+-------+--------+------------+------------+----------+-----------------------+--------------+-------------------------------------------------------+
 | Index | OpCode            | # Ops | # MACs | Acc Cycles | CPU Cycles | Time (s) | Input Shape           | Output Shape | Options                                               |
 +-------+-------------------+-------+--------+------------+------------+----------+-----------------------+--------------+-------------------------------------------------------+
 | 0     | depthwise_conv_2d | 3.3M  | 1.5M   | 2.5M       | 33.2k      | 31.5m    | 1x180x180x1,1x5x5x8,8 | 1x88x88x8    | Multiplier:8 padding:valid stride:2x2 activation:relu |
 | 1     | average_pool_2d   | 77.4k | 0      | 54.3k      | 1.8M       | 23.8m    | 1x88x88x8             | 1x44x44x8    | Padding:valid stride:2x2 filter:2x2 activation:none   |
 | 2     | conv_2d           | 4.1M  | 2.0M   | 1.6M       | 10.6k      | 20.4m    | 1x44x44x8,16x3x3x8,16 | 1x42x42x16   | Padding:valid stride:1x1 activation:relu              |
 | 3     | mean              | 0     | 0      | 0          | 3.5M       | 43.9m    | 1x42x42x16,2          | 1x16         | Type=reduceroptions                                   |
 | 4     | fully_connected   | 528.0 | 256.0  | 496.0      | 2.2k       | 30.0u    | 1x16,16x16,16         | 1x16         | Activation:none                                       |
 +-------+-------------------+-------+--------+------------+------------+----------+-----------------------+--------------+-------------------------------------------------------+

Model Diagram

mltk view  fingerprint_signature_generator --tflite