Skip to content

Commit

Permalink
Merge pull request #32 from AmbiqAI/canary
Browse files Browse the repository at this point in the history
Version 1.5.1
  • Loading branch information
apage224 authored Oct 2, 2024
2 parents aa40aed + 131d307 commit f9a4e64
Show file tree
Hide file tree
Showing 39 changed files with 1,041 additions and 1,065 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "Python 3",
"image": "mcr.microsoft.com/devcontainers/python:1-3.12",
"image": "mcr.microsoft.com/devcontainers/python:1-3.11",

"features": {
"ghcr.io/devcontainers/features/git:1": {
"ppa": true,
"version": "latest"
"version": "system"
},
"ghcr.io/devcontainers-contrib/features/pipenv:2": {
"version": "latest"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: '3.12'
python-version: '3.11'
cache: 'poetry'
- run: poetry install
- run: poetry run task lint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
python-version: '3.11'
cache: 'poetry'
- name: Install and Build 🔧
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.11'
cache: 'poetry'
- name: Install and Build 🔧
run: |
Expand Down
2 changes: 1 addition & 1 deletion configs/arr-4-eff-lg.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"qat": false,
"mode": "FP32",
"io_type": "float32",
"concrete": true,
"conversion": "CONCRETE",
"debug": false
},

Expand Down
2 changes: 1 addition & 1 deletion configs/arr-4-eff-sm.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"qat": false,
"mode": "FP32",
"io_type": "float32",
"concrete": true,
"conversion": "CONCRETE",
"debug": false
},

Expand Down
2 changes: 1 addition & 1 deletion configs/beat-2-eff-sm.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"qat": false,
"mode": "FP32",
"io_type": "float32",
"concrete": true,
"conversion": "CONCRETE",
"debug": false
},

Expand Down
2 changes: 1 addition & 1 deletion configs/beat-3-eff-sm.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"qat": false,
"mode": "FP32",
"io_type": "float32",
"concrete": true,
"conversion": "CONCRETE",
"debug": false
},

Expand Down
2 changes: 1 addition & 1 deletion configs/den-ppg-tcn-lg.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"qat": false,
"mode": "FP32",
"io_type": "float32",
"concrete": true,
"conversion": "CONCRETE",
"debug": false
},

Expand Down
2 changes: 1 addition & 1 deletion configs/den-ppg-tcn-sm.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"qat": false,
"mode": "FP32",
"io_type": "float32",
"concrete": true,
"conversion": "CONCRETE",
"debug": false
},

Expand Down
2 changes: 1 addition & 1 deletion configs/den-tcn-lg.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"qat": false,
"mode": "FP32",
"io_type": "float32",
"concrete": true,
"conversion": "CONCRETE",
"debug": false
},

Expand Down
2 changes: 1 addition & 1 deletion configs/den-tcn-sm.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"qat": false,
"mode": "FP32",
"io_type": "float32",
"concrete": true,
"conversion": "CONCRETE",
"debug": false
},

Expand Down
2 changes: 1 addition & 1 deletion configs/fnd-eff-lg.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"qat": false,
"mode": "FP32",
"io_type": "float32",
"concrete": true,
"conversion": "CONCRETE",
"debug": false
},

Expand Down
2 changes: 1 addition & 1 deletion configs/fnd-eff-sm.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"qat": false,
"mode": "FP32",
"io_type": "float32",
"concrete": true,
"conversion": "CONCRETE",
"debug": false
},

Expand Down
2 changes: 1 addition & 1 deletion configs/seg-2-tcn-sm.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"qat": false,
"mode": "INT8",
"io_type": "int8",
"concrete": true,
"conversion": "CONCRETE",
"debug": false
},

Expand Down
2 changes: 1 addition & 1 deletion configs/seg-4-tcn-lg.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"qat": false,
"mode": "INT8",
"io_type": "int8",
"concrete": true,
"conversion": "CONCRETE",
"debug": false
},

Expand Down
2 changes: 1 addition & 1 deletion configs/seg-4-tcn-sm.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"qat": false,
"mode": "INT8",
"io_type": "int8",
"concrete": true,
"conversion": "CONCRETE",
"debug": false
},

Expand Down
2 changes: 1 addition & 1 deletion configs/seg-ppg-2-tcn-sm.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"qat": false,
"mode": "INT8",
"io_type": "int8",
"concrete": true,
"conversion": "CONCRETE",
"debug": false
},

Expand Down
Binary file removed docs/assets/guides/hk-dashboard.jpeg
Binary file not shown.
Binary file added docs/assets/guides/tileio-dashboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/heartkit-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
111 changes: 0 additions & 111 deletions docs/guides/heartkit-demo.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/guides/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ This section contains guides to help with various aspects of HeartKit. The guide
## <span class="sk-h2-span">Hardware Guides</span>

- **[Run simple demo on EVB]()**: Running a demo using Ambiq SoC as backend inference engine.
- **[Full HeartKit EVB App](heartkit-demo.md)**: A guide to running a multi-headed model demo on Ambiq EVB.
- **[HeartKit Tileio Demo](https://ambiqai.github.io/tileio-docs/demos/heartkit/)**: A guide to running a multi-headed model demo on Ambiq EVB.
2 changes: 1 addition & 1 deletion docs/tasks/denoise.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Dataloaders are available for the following datasets:

## <span class="sk-h2-span">Pre-trained Models</span>

The following table provides the latest performance and accuracy results of denoising models. Additional result details can be found in [Model Zoo → Denoise](../zoo/denoise.md).
The following table provides the latest performance and accuracy results of denoising models. Additional result details can be found in [Model Zoo → Denoise](../zoo/index.md).


--8<-- "assets/zoo/denoise/denoise-model-zoo-table.md"
Expand Down
2 changes: 1 addition & 1 deletion docs/tasks/rhythm.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Dataloaders are available for the following datasets:

## <span class="sk-h2-span">Pre-trained Models</span>

The following table provides the latest performance and accuracy results for rhythm models. Additional result details can be found in [Model Zoo → Rhythm](../zoo/rhythm.md).
The following table provides the latest performance and accuracy results for rhythm models. Additional result details can be found in [Model Zoo → Rhythm](../zoo/index.md).


--8<-- "assets/zoo/rhythm/rhythm-model-zoo-table.md"
Expand Down
2 changes: 1 addition & 1 deletion docs/tasks/segmentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Dataloaders are available for the following datasets:

## <span class="sk-h2-span">Pre-Trained Models</span>

The following table provides the latest performance and accuracy results for segmentation models. Additional result details can be found in [Model Zoo → Segmentation](../zoo/segmentation.md).
The following table provides the latest performance and accuracy results for segmentation models. Additional result details can be found in [Model Zoo → Segmentation](../zoo/index.md).

--8<-- "assets/zoo/segmentation/segmentation-model-zoo-table.md"

Expand Down
6 changes: 3 additions & 3 deletions docs/zoo/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The following table provides the latest performance and accuracy results for den
| __DEN-PPG-TCN-SM__ | Synthetic | 100Hz | 2.5s | TCN | 3.5K | 1.1M | 92.1% COS |


## <span class="sk-h2-span">[Signal Segmentation Task](./tasks/segmentation.md)</span>
## <span class="sk-h2-span">[Signal Segmentation Task](../tasks/segmentation.md)</span>

The following table provides the latest performance and accuracy results for ECG segmentation models.

Expand All @@ -25,7 +25,7 @@ The following table provides the latest performance and accuracy results for ECG
| __SEG-PPG-2-TCN-SM__ | Synthetic | 100Hz | 2.5s | 2 | TCN | 4K | 1.43M | 98.6% F1 |


## <span class="sk-h2-span">[Rhythm Classification Task](./tasks/rhythm.md)</span>
## <span class="sk-h2-span">[Rhythm Classification Task](../tasks/rhythm.md)</span>

The following table provides the latest performance and accuracy results for rhythm classification models.

Expand All @@ -35,7 +35,7 @@ The following table provides the latest performance and accuracy results for rhy
| __ARR-4-EFF-SM__ | LSAD | 100Hz | 5s | 4 | EfficientNetV2 | 27K | 1.6M | 95.9% F1 |


## <span class="sk-h2-span">[Beat Classification Task](./tasks/beat.md)</span>
## <span class="sk-h2-span">[Beat Classification Task](../tasks/beat.md)</span>

The following table provides the latest performance and accuracy results for beat classification models.

Expand Down
3 changes: 2 additions & 1 deletion heartkit/backends/evb.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def open(self):
3. Send model to EVB via eRPC
"""
self._transport = get_serial_transport(vid_pid="51966:16385", baudrate=115200)

self._transport = get_serial_transport(vid_pid="51966:16401", baudrate=115200)
client_manager = erpc.client.ClientManager(self._transport, erpc.basic_codec.BasicCodec)
self._client = pc2evb.client.pc_to_evbClient(client_manager)
self.send_model()
Expand Down
7 changes: 5 additions & 2 deletions heartkit/datasets/lsad.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,10 @@ def signal_label_generator(
y[pt_lbls] = 1
num_samples = sum((samples_per_tgt[tgt_labels.index(i)] for i in pt_lbls))
elif label_format == "one_hot":
raise NotImplementedError()
y = np.zeros(num_classes, dtype=np.int32)
pt_lbl = random.choices(pt_lbls, pt_lbl_weights, k=1)[0]
y[pt_lbl] = 1
num_samples = samples_per_tgt[tgt_labels.index(pt_lbl)]
elif label_format is None:
# Its possible to have multiple labels, we assign based on weights
y = random.choices(pt_lbls, pt_lbl_weights, k=1)[0]
Expand Down Expand Up @@ -478,7 +481,7 @@ def filter_patients_for_labels(
patients_labels = self.get_patients_labels(patient_ids, label_map, label_type)
# Find any patient with empty list
label_mask = np.array([len(x) > 0 for x in patients_labels])
neg_mask = label_mask == -1
neg_mask = ~label_mask
num_neg = neg_mask.sum()
if num_neg > 0:
logger.debug(f"Removed {num_neg} of {patient_ids.size} patients w/ no target class")
Expand Down
9 changes: 6 additions & 3 deletions heartkit/datasets/ptbxl.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def signal_label_generator(
# END IF

# Target labels and mapping
tgt_labels = sorted(list(set((lbl for lbl in label_map.values() if lbl != -1))))
tgt_labels = sorted(set((lbl for lbl in label_map.values() if lbl != -1)))
label_key = self.label_key(label_type)
num_classes = len(tgt_labels)

Expand Down Expand Up @@ -471,7 +471,10 @@ def signal_label_generator(
# y = np.expand_dims(y, axis=0)
num_samples = sum((samples_per_tgt[tgt_labels.index(i)] for i in pt_lbls))
elif label_format == "one_hot":
raise NotImplementedError()
y = np.zeros(num_classes, dtype=np.int32)
pt_lbl = random.choices(pt_lbls, pt_lbl_weights, k=1)[0]
y[pt_lbl] = 1
num_samples = samples_per_tgt[tgt_labels.index(pt_lbl)]
elif label_format is None:
# Its possible to have multiple labels, we assign based on weights
y = random.choices(pt_lbls, pt_lbl_weights, k=1)[0]
Expand Down Expand Up @@ -562,7 +565,7 @@ def filter_patients_for_labels(
patients_labels = self.get_patients_labels(patient_ids, label_map, label_type)
# Find any patient with empty list
label_mask = np.array([len(x) > 0 for x in patients_labels])
neg_mask = label_mask == -1
neg_mask = ~label_mask
num_neg = neg_mask.sum()
if num_neg > 0:
logger.debug(f"Removed {num_neg} of {patient_ids.size} patients w/ no target class")
Expand Down
Loading

0 comments on commit f9a4e64

Please sign in to comment.