summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbuethe <jbuethe@amazon.de>2023-03-10 17:51:12 +0000
committerjbuethe <jbuethe@amazon.de>2023-03-10 17:51:12 +0000
commit08476da7b35dd06005dbbe2c90adf2f80c28b423 (patch)
tree684698766bd7dcc983e7ef3e4b74b5567f0cd560
parentd5f96d82d473a4e98c6bf7fcdb131ac38cda676a (diff)
downloadopus-08476da7b35dd06005dbbe2c90adf2f80c28b423.tar.gz
updated bitrate range
-rw-r--r--opus_calibration/eval.ipynb151
-rw-r--r--opus_calibration/results.txt37
2 files changed, 188 insertions, 0 deletions
diff --git a/opus_calibration/eval.ipynb b/opus_calibration/eval.ipynb
new file mode 100644
index 00000000..1cc47764
--- /dev/null
+++ b/opus_calibration/eval.ipynb
@@ -0,0 +1,151 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import numpy as np\n",
+ "import matplotlib.pyplot as plt"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "x = np.genfromtxt('results.txt', delimiter=\" \")\n",
+ "x.sort(0)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 27,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# some smoothing\n",
+ "ex = np.exp(x[:, 1])\n",
+ "ex_smooth = ex.copy()\n",
+ "ex_smooth[1:-1] = (ex[1:-1] + ex[0:-2] + ex[2:]) / 3\n",
+ "ex_smooth[0] = (ex[0] + ex[1]) / 2\n",
+ "ex_smooth[-1] = (ex[-1] + ex[-2]) / 2\n",
+ "y_smooth = np.log(ex_smooth)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 45,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n"
+ ]
+ }
+ ],
+ "source": [
+ "# restrict bitrate range\n",
+ "bitrates = list(x[:, 0])\n",
+ "mos = list(x[:, 1])\n",
+ "stop_idx = bitrates.index(22000) + 1\n",
+ "\n",
+ "bitrates = bitrates[:stop_idx]\n",
+ "mos = mos[:stop_idx]\n",
+ "\n",
+ "\n",
+ "num_bitrates = 100\n",
+ "a, b = mos[0], mos[-1]\n",
+ "points = a + (b - a) * np.arange(num_bitrates) / (num_bitrates - 1)\n",
+ "\n",
+ "sample_bitrates = np.interp(points, mos, bitrates)\n",
+ "\n",
+ "print(f\"\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 46,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "array([ 6000, 6059, 6119, 6178, 6237, 6296, 6356, 6415, 6474,\n",
+ " 6520, 6556, 6592, 6628, 6664, 6700, 6736, 6772, 6808,\n",
+ " 6844, 6880, 6916, 6952, 6988, 7028, 7071, 7114, 7157,\n",
+ " 7199, 7242, 7285, 7327, 7370, 7413, 7455, 7498, 7527,\n",
+ " 7556, 7584, 7613, 7642, 7670, 7699, 7728, 7756, 7785,\n",
+ " 7813, 7842, 7871, 7899, 7928, 7956, 7985, 8039, 8121,\n",
+ " 8202, 8284, 8366, 8447, 8533, 8625, 8718, 8810, 8903,\n",
+ " 8995, 9119, 9244, 9369, 9495, 9569, 9640, 9712, 9783,\n",
+ " 9855, 9926, 9998, 10162, 10329, 10495, 10691, 10888, 11108,\n",
+ " 11359, 11562, 11704, 11846, 11988, 12299, 12678, 13126, 13519,\n",
+ " 13750, 13980, 14521, 15223, 15708, 16108, 17163, 17817, 19010,\n",
+ " 20000], dtype=int32)"
+ ]
+ },
+ "execution_count": 46,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "sample_bitrates.round().astype(np.int32)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 47,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "100"
+ ]
+ },
+ "execution_count": 47,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "len(sample_bitrates)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "torch",
+ "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.9.12"
+ },
+ "orig_nbformat": 4
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/opus_calibration/results.txt b/opus_calibration/results.txt
new file mode 100644
index 00000000..81339960
--- /dev/null
+++ b/opus_calibration/results.txt
@@ -0,0 +1,37 @@
+10000 3.6769871171800843
+10500 3.764050840421487
+11000 3.837912642015452
+11500 3.8958699466617963
+12000 3.998301962253095
+12500 4.042832948476001
+13000 4.074064341513559
+13500 4.109692211369522
+14000 4.172784194388159
+14500 4.1984370021723
+15000 4.219923239627867
+15500 4.238952635505424
+16000 4.283401744056294
+16500 4.297923285239222
+17000 4.310123987780273
+17500 4.327046328221872
+18000 4.354865359896012
+18500 4.36331783299531
+19000 4.373523086688597
+19500 4.38536238245685
+20000 4.4028386414506056
+20500 4.412652008406079
+21000 4.420093487843909
+21500 4.426490423333554
+22000 4.441486788160018
+22500 4.447735896195902
+23000 4.454637068968553
+23500 4.458733846231834
+24000 4.4704071631419255
+6000 1.5247552916597167
+6500 1.7700358156029505
+7000 2.1739995701015755
+7500 2.514612697159668
+8000 3.0225791815886365
+8500 3.2006033440582624
+9000 3.357733997073186
+9500 3.473776563129959