Skip to content

Commit

Permalink
Merge pull request #15 from NaelF/binary_cop
Browse files Browse the repository at this point in the history
[Notebook] Added BinCoP face-mask detection example
  • Loading branch information
maltanar authored Aug 27, 2021
2 parents 61febea + 207f5ed commit c89e819
Show file tree
Hide file tree
Showing 6 changed files with 490 additions and 5 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## <img src=https://raw.githubusercontent.com/Xilinx/finn/master/docs/img/finn-logo.png width=128/> Dataflow Accelerator Examples
## <img src=https://raw.githubusercontent.com/Xilinx/finn/github-pages/docs/img/finn-logo.png width=128/> Dataflow Accelerator Examples
*for PYNQ on Zynq and Alveo*

<img align="left" src="docs/img/finn-example.png" alt="drawing" style="margin-right: 20px" width="250"/>
Expand Down Expand Up @@ -67,6 +67,9 @@ dummy_out = accel.execute(dummy_in)
| <img src="docs/img/mnist.jpg" width="150"/><br/><br>MNIST | 3-layer fully-connected | several variants:<br>1/2-bit weights/activations | all |
| <img src="docs/img/imagenet.jpg" width="150"/><br/><br>ImageNet | MobileNet-v1 | 4-bit weights and activations<br>8-bit first layer weights | Alveo U250<br>ZCU104 |
| <img src="docs/img/imagenet.jpg" width="150"/><br/><br>ImageNet | ResNet-50 | 1-bit weights 2-bit activations<br>4-bit residuals<br>8-bit first/last layer weights | Alveo U250 |
| <img src="docs/img/maskedfacenet.jpg" width="150"/><br/><br>MaskedFace-Net | [BinaryCoP](https://arxiv.org/pdf/2102.03456)<br/>*Contributed by TU Munich+BMW* | 1-bit weights and activations | Pynq-Z1 |

We welcome community contributions to add more examples to this repo!

## Supported Boards

Expand Down
Binary file added docs/img/maskedfacenet.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions finn_examples/bitfiles/bitfiles.zip.link
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Pynq-Z1": {
"url": "https://github.com/Xilinx/finn-examples/releases/download/v0.0.1a/Pynq-Z1.zip",
"md5sum": "04f4887540a2156bd2886c9bb2bb2ff6"
"url": "https://github.com/Xilinx/finn-examples/releases/download/binary-cop/Pynq-Z1.zip",
"md5sum": "8d36644dfa90711767e979c1a437b46d"
},
"Pynq-Z2": {
"url": "https://github.com/Xilinx/finn-examples/releases/download/v0.0.1a/Pynq-Z2.zip",
Expand Down
18 changes: 17 additions & 1 deletion finn_examples/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@
"oshape_packed": (1, 1, 1),
}

_bincop_cnv_io_shape_dict = {
"idt": DataType.UINT8,
"odt": DataType.UINT8,
"ishape_normal": (1, 72, 72, 3),
"oshape_normal": (1, 1),
"ishape_folded": (1, 1, 72, 72, 1, 3),
"oshape_folded": (1, 1, 1),
"ishape_packed": (1, 1, 72, 72, 1, 3),
"oshape_packed": (1, 1, 1),
}

_imagenet_top5inds_io_shape_dict = {
"idt": DataType.UINT8,
"odt": DataType.UINT16,
Expand All @@ -83,7 +94,6 @@
"number_of_external_weights": 1
}


# from https://github.com/Xilinx/PYNQ-HelloWorld/blob/master/setup.py
# get current platform: either edge or pcie

Expand Down Expand Up @@ -202,6 +212,12 @@ def cnv_w2a2_cifar10(target_platform=None):
filename = find_bitfile(model_name, target_platform)
return FINNExampleOverlay(filename, driver_mode, _cifar10_cnv_io_shape_dict)

def bincop_cnv(target_platform=None):
target_platform = resolve_target_platform(target_platform)
driver_mode = get_driver_mode()
model_name = "bincop-cnv"
filename = find_bitfile(model_name, target_platform)
return FINNExampleOverlay(filename, driver_mode, _bincop_cnv_io_shape_dict)

def mobilenetv1_w4a4_imagenet(target_platform=None):
target_platform = resolve_target_platform(target_platform)
Expand Down
Loading

0 comments on commit c89e819

Please sign in to comment.