Skip to content

Commit

Permalink
QR Code Detection Model (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
ermanok authored Jun 6, 2024
1 parent 53deb87 commit 3b01ca3
Show file tree
Hide file tree
Showing 7 changed files with 4,752 additions and 0 deletions.
304 changes: 304 additions & 0 deletions networks/ai85-tinierssd-kpts-qr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,304 @@
---
# HWC (little data) configuration for SVHN
# Parallel Model

arch: ai85tinierssdqr
dataset: qrcode_160_120_kpts_ext

layers:

# Layer 0: fire1, inp: 3x320x240
- out_offset: 0x1000
in_offset: 0x0000
processors: 0x0000000000000007
output_processors: 0xffffffff00000000
operation: conv2d
kernel_size: 3x3
pad: 1
activate: ReLU
streaming: true

# Layer 1: fire2, inp: 32x320x240
- out_offset: 0x1000
in_offset: 0x1000
processors: 0xffffffff00000000
output_processors: 0x00000000ffffffff
operation: conv2d
kernel_size: 3x3
pad: 1
activate: ReLU
streaming: true

# Layer 2: fire3, inp: 32x320x240
- out_offset: 0x2440 # 0x2000
in_offset: 0x1000
processors: 0x00000000ffffffff
output_processors: 0xffffffffffffffff
operation: conv2d
kernel_size: 3x3
pad: 1
activate: ReLU
max_pool: 2
pool_stride: 2
streaming: true

# Layer 3: fire3_1, inp: 64x160x120
- out_offset: 0x3000
in_offset: 0x2440
processors: 0xffffffffffffffff
output_processors: 0xffffffffffffffff
operation: conv2d
kernel_size: 3x3
pad: 1
activate: ReLU
max_pool: 2
pool_stride: 2
streaming: true

# Layer 4: fire4, inp: 64x80x60
- out_offset: 0x4000
in_offset: 0x3000
processors: 0xffffffffffffffff
output_processors: 0xffffffffffffffff
operation: conv2d
kernel_size: 3x3
pad: 1
activate: ReLU
streaming: true

# Layer 5: fire5, inp: 64x80x60
- out_offset: 0x5000 # 0x12C0
in_offset: 0x4000
processors: 0xffffffffffffffff
output_processors: 0xffffffffffffffff
operation: conv2d
kernel_size: 3x3
pad: 1
activate: ReLU
max_pool: 2
pool_stride: 2
streaming: true

# Layer 6: fire6, inp: 64x40x30
- out_offset: 0x6400 # 0x12C0
in_offset: 0x5000
processors: 0xffffffffffffffff
output_processors: 0xffffffffffffffff
operation: conv2d
kernel_size: 3x3
pad: 1
activate: ReLU

# Layer 7: fire7, inp: 64x40x30
- out_offset: 0x0000 # 0x2580
in_offset: 0x6400
processors: 0xffffffffffffffff
output_processors: 0xffffffffffffffff
operation: conv2d
kernel_size: 3x3
pad: 1
activate: ReLU

# Layer 8: fire8, inp: 128x40x30
- name: fire8
out_offset: 0x3000 # 0x12C0
in_offset: 0x0000
processors: 0xffffffffffffffff
output_processors: 0x00000000ffffffff
operation: conv2d
kernel_size: 3x3
pad: 1
activate: ReLU

# Layer 9: fire9, inp: 32x40x30
- name: fire9
out_offset: 0x3000 # 0x04B0
in_offset: 0x3000
processors: 0x00000000ffffffff
output_processors: 0xffffffff00000000
operation: conv2d
kernel_size: 3x3
pad: 1
activate: ReLU
max_pool: 2
pool_stride: 2

# Layer 10: fire10, inp: 32x20x15
- name: fire10
out_offset: 0x4400 # 0x0280
in_offset: 0x3000
processors: 0xffffffff00000000
output_processors: 0x00000000ffffffff
operation: conv2d
kernel_size: 3x3
pad: 1
activate: ReLU
max_pool: 2
pool_stride: 2

# Layer 11: conv12_1, inp: 32x10x7
- out_offset: 0x5000 # 0x0280
in_offset: 0x4400
processors: 0x00000000ffffffff
output_processors: 0x000000000000ffff
operation: conv2d
kernel_size: 3x3
pad: 1
activate: ReLU

# Layer 12: conv12_2, inp: 16x10x7
- name: conv12_2
out_offset: 0x5000 # 0x003C
in_offset: 0x5000
processors: 0x000000000000ffff
output_processors: 0x00000000ffff0000
operation: conv2d
kernel_size: 3x3
pad: 1
activate: ReLU
max_pool: 2
pool_stride: 2

# Layer 13: loc_conv8, inp: 32x40x30
- out_offset: 0x5400 # 0x12C0
in_offset: 0x3000
processors: 0x00000000ffffffff
output_processors: 0x000000000000ffff
operation: conv2d
kernel_size: 3x3
pad: 1
in_sequences: fire8
output: true
activate: None

# Layer 14: loc_conv9, inp: 32x20x15
- out_offset: 0x66C0 # 0x04B0
in_offset: 0x3000
processors: 0xffffffff00000000
output_processors: 0x000000000000ffff
operation: conv2d
kernel_size: 3x3
pad: 1
in_sequences: fire9
output: true
activate: None

# Layer 15: loc_conv10, inp: 32x10x7
- out_offset: 0x6B70 # 0x0118
in_offset: 0x4400
processors: 0x00000000ffffffff
output_processors: 0x000000000000ffff
operation: conv2d
kernel_size: 3x3
pad: 1
in_sequences: fire10
output: true
activate: None

# Layer 16: loc_conv12_2, inp: 16x5x3
- out_offset: 0x6C88 # 0x003C
in_offset: 0x5000
processors: 0x00000000ffff0000
output_processors: 0x000000000000ffff
operation: conv2d
kernel_size: 3x3
pad: 1
in_sequences: conv12_2
output: true
activate: None

# Layer 17: kpts_fire8, inp: 32x40x30
- out_offset: 0x4000 # 0x12C0
in_offset: 0x3000
processors: 0x00000000ffffffff
output_processors: 0xffffffff00000000
operation: conv2d
kernel_size: 3x3
pad: 1
in_sequences: fire8
output: true
activate: None

# Layer 18: kpts_fire9, inp: 32x20x15
- out_offset: 0x52C0 # 0x04B0
in_offset: 0x3000
processors: 0xffffffff00000000
output_processors: 0xffffffff00000000
operation: conv2d
kernel_size: 3x3
pad: 1
in_sequences: fire9
output: true
activate: None

# Layer 19: kpts_fire10, inp: 32x10x7
- out_offset: 0x5770 # 0x0118
in_offset: 0x4400
processors: 0x00000000ffffffff
output_processors: 0xffffffff00000000
operation: conv2d
kernel_size: 3x3
pad: 1
in_sequences: fire10
output: true
activate: None

# Layer 20: kpts_fire12_2, inp: 16x5x3
- out_offset: 0x5888
in_offset: 0x5000
processors: 0x00000000ffff0000
output_processors: 0xffffffff00000000
operation: conv2d
kernel_size: 3x3
pad: 1
in_sequences: conv12_2
output: true
activate: None

# Layer 21: cl_fire8, inp: 32x40x30
- out_offset: 0x5400 # 0x12C0
in_offset: 0x3000
processors: 0x00000000ffffffff
output_processors: 0x0000000000ff0000
operation: conv2d
kernel_size: 3x3
pad: 1
in_sequences: fire8
output: true
activate: None

# Layer 22: cl_conv9, inp: 32x20x15
- out_offset: 0x66C0 # 0x04B0
in_offset: 0x3000
processors: 0xffffffff00000000
output_processors: 0x0000000000ff0000
operation: conv2d
kernel_size: 3x3
pad: 1
in_sequences: fire9
output: true
activate: None

# Layer 23: cl_conv10, inp: 32x10x7
- out_offset: 0x6B70 # 0x0118
in_offset: 0x4400
processors: 0x00000000ffffffff
output_processors: 0x0000000000ff0000
operation: conv2d
kernel_size: 3x3
pad: 1
in_sequences: fire10
output: true
activate: None

# Layer 24: cl_conv12_2, inp: 16x5x3
- out_offset: 0x6C88 # 0x003C
in_offset: 0x5000
processors: 0x00000000ffff0000
output_processors: 0x0000000000ff0000
operation: conv2d
kernel_size: 3x3
pad: 1
in_sequences: conv12_2
output: true
activate: None
6 changes: 6 additions & 0 deletions scripts/gen_qrcode_tinierssd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
DEVICE="MAX78000"
TARGET="sdk/Examples/$DEVICE/CNN"
COMMON_ARGS="--device $DEVICE --timer 0 --display-checkpoint --verbose"

python ai8xize.py --test-dir $TARGET --prefix tinierssd_kpts_qrcode --checkpoint-file trained/ai85-qrcode-tinierssd-kpts-qat8-q.pth.tar --config-file networks/ai85-tinierssd-kpts-qr.yaml --fifo $COMMON_ARGS --synthesize-input 0x2580 "$@"
2 changes: 2 additions & 0 deletions scripts/quantize_qrcode_tinierssd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
python quantize.py trained/ai85-qrcode-tinierssd-qat8.pth.tar trained/ai85-qrcode-tinierssd-qat8-q.pth.tar --device MAX78000 -v
Binary file added tests/sample_qrcode_160_120_kpts_ext.npy
Binary file not shown.
Binary file added trained/ai85-qrcode-tinierssd-kpts-qat8-q.pth.tar
Binary file not shown.
Loading

0 comments on commit 3b01ca3

Please sign in to comment.