Skip to content

Commit

Permalink
egs: update test dataset configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
haoxiangsnr committed Jan 23, 2024
1 parent b81459f commit 1f49043
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 3 deletions.
144 changes: 144 additions & 0 deletions notebooks/check_metric.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# Apply profit to the metrics\n",
"def get_polyfit_val(self, sig, bak, ovr, is_personalized_MOS=False):\n",
" if is_personalized_MOS:\n",
" p_ovr = np.poly1d([-0.00533021, 0.005101, 1.18058466, -0.11236046])\n",
" p_sig = np.poly1d([-0.01019296, 0.02751166, 1.19576786, -0.24348726])\n",
" p_bak = np.poly1d([-0.04976499, 0.44276479, -0.1644611, 0.96883132])\n",
" else:\n",
" p_ovr = np.poly1d([-0.06766283, 1.11546468, 0.04602535])\n",
" p_sig = np.poly1d([-0.08397278, 1.22083953, 0.0052439])\n",
" p_bak = np.poly1d([-0.13166888, 1.60915514, -0.39604546])\n",
"\n",
" sig_poly = p_sig(sig)\n",
" bak_poly = p_bak(bak)\n",
" ovr_poly = p_ovr(ovr)\n",
"\n",
" return sig_poly, bak_poly, ovr_poly"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(3.163024522199478, 3.6073455928302955, 2.750688625478262)\n"
]
}
],
"source": [
"a_lif_metrics = (3.36576, 3.47725, 2.95402)\n",
"a_lif_poly = get_polyfit_val(None, *a_lif_metrics)\n",
"print(a_lif_poly)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"synops = 419556 * 2\n",
"neuronops = 2762\n",
"buffer_latency = 0.032\n",
"enc_dec_latency = 0.030 / 1000\n",
"dns_latency = 0\n",
"dt = 0.008"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"866732\n",
"Solution Latency : 32.030 ms\n",
"Power proxy (Effective SynOPS) : 108341500.000 ops/s\n",
"PDP proxy (SynOPS-delay product) : 1790.797 ops\n"
]
}
],
"source": [
"latency = buffer_latency + enc_dec_latency + dns_latency\n",
"effective_synops_rate = (synops + 10 * neuronops) / dt\n",
"synops_delay_product = 55.91 * 10**3 * latency\n",
"\n",
"print(synops + 10 * neuronops)\n",
"print(f'Solution Latency : {latency * 1000: .3f} ms')\n",
"print(f'Power proxy (Effective SynOPS) : {effective_synops_rate:.3f} ops/s')\n",
"print(f'PDP proxy (SynOPS-delay product) : {synops_delay_product: .3f} ops')"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Solution Latency : 32.030 ms\n",
"Power proxy (Effective SynOPS) : 108341500.000 ops/s\n",
"PDP proxy (SynOPS-delay product) : 3470178.245 ops\n"
]
}
],
"source": [
"latency = buffer_latency + enc_dec_latency + dns_latency\n",
"effective_synops_rate = (synops + 10 * neuronops) / dt\n",
"synops_delay_product = effective_synops_rate * latency\n",
"\n",
"print(f'Solution Latency : {latency * 1000: .3f} ms')\n",
"print(f'Power proxy (Effective SynOPS) : {effective_synops_rate:.3f} ops/s')\n",
"print(f'PDP proxy (SynOPS-delay product) : {synops_delay_product: .3f} ops')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "audiozen",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}
6 changes: 3 additions & 3 deletions recipes/intel_ndns/spiking_fullsubnet/baseline_m.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ num_workers = 8
[test_dataset]
path = "dataloader.DNSAudio"
[test_dataset.args]
root = "/datasets/IntelNeuromorphicDNSChallenge-latest/data/MicrosoftDNS_4_ICASSP/test_set_1/"
root = "/nfs/xhao/data/intel_ndns/test_set/"
train = false
[test_dataset.dataloader]
batch_size = 24
num_workers = 8
batch_size = 1
num_workers = 0
2 changes: 2 additions & 0 deletions recipes/intel_ndns/spiking_fullsubnet/dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def __init__(self, root="./", limit=None, offset=0, sublen=6, train=True) -> Non
if limit:
self.noisy_files = self.noisy_files[:limit]

print(f"Found {len(self.noisy_files)} files.")

self.file_id_from_name = re.compile(r"fileid_(\d+)")
self.snr_from_name = re.compile(r"snr(-?\d+)")
self.target_level_from_name = re.compile(r"tl(-?\d+)")
Expand Down
6 changes: 6 additions & 0 deletions recipes/intel_ndns/spiking_fullsubnet/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,9 @@ def validation_epoch_end(self, outputs, log_to_tensorboard=True):
self.writer.add_scalar(f"metrics_{dataloader_idx}/{metric}", value, self.state.epochs_trained)

return score

def test_step(self, batch, batch_idx, dataloader_idx=0):
return self.validation_step(batch, batch_idx, dataloader_idx)

def test_epoch_end(self, outputs, log_to_tensorboard=True):
return self.test_epoch_end(outputs, log_to_tensorboard=False)

0 comments on commit 1f49043

Please sign in to comment.