cleanup, more modes

master
Jeff Moe 2022-08-17 10:06:51 -06:00
parent 8dd443ab30
commit 8aee0ac624
3 changed files with 89 additions and 104 deletions

View File

@ -74,29 +74,12 @@
"from sklearn.decomposition import PCA\n", "from sklearn.decomposition import PCA\n",
"\n", "\n",
"# Seaborn pip dependency\n", "# Seaborn pip dependency\n",
"import seaborn as sns" "import seaborn as sns\n",
] "\n",
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Interact\n",
"# https://ipywidgets.readthedocs.io/en/stable/examples/Using%20Interact.html\n",
"from __future__ import print_function\n", "from __future__ import print_function\n",
"from ipywidgets import interact, interactive, fixed, interact_manual\n", "from ipywidgets import interact, interactive, fixed, interact_manual\n",
"import ipywidgets as widgets" "import ipywidgets as widgets\n",
] "\n",
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Display Images\n",
"from IPython.display import display, Image" "from IPython.display import display, Image"
] ]
}, },
@ -106,7 +89,13 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"ENCODING='FSK9k6'" "#ENCODING='APT'\n",
"#ENCODING='CW'\n",
"#ENCODING='FM'\n",
"#ENCODING='FSK9k6'\n",
"ENCODING='GMSK2k4'\n",
"#ENCODING='GMSK4k8'\n",
"#ENCODING='USB'"
] ]
}, },
{ {
@ -208,7 +197,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"print(num_test)" "print(\"Number of observations to test:\", num_test)"
] ]
}, },
{ {
@ -217,7 +206,6 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"# This function will plot images in the form of a grid with 1 row and 3 columns where images are placed in each column.\n",
"def plotImages(images_arr):\n", "def plotImages(images_arr):\n",
" fig, axes = plt.subplots(1, 3, figsize=(20,20))\n", " fig, axes = plt.subplots(1, 3, figsize=(20,20))\n",
" axes = axes.flatten()\n", " axes = axes.flatten()\n",
@ -301,6 +289,13 @@
" rating = 'good'\n", " rating = 'good'\n",
"print('Observation: %s' % (rating))" "print('Observation: %s' % (rating))"
] ]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {

View File

@ -69,18 +69,13 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"# Visualization\n",
"%matplotlib inline\n", "%matplotlib inline\n",
"import matplotlib.pyplot as plt\n", "import matplotlib.pyplot as plt\n",
"import numpy as np\n", "import numpy as np\n",
"from sklearn.decomposition import PCA\n", "from sklearn.decomposition import PCA\n",
"# Seaborn pip dependency\n",
"import seaborn as sns\n", "import seaborn as sns\n",
"# Interact\n",
"# https://ipywidgets.readthedocs.io/en/stable/examples/Using%20Interact.html\n",
"from ipywidgets import interact, interactive, fixed, interact_manual\n", "from ipywidgets import interact, interactive, fixed, interact_manual\n",
"import ipywidgets as widgets\n", "import ipywidgets as widgets\n",
"# Display Images\n",
"from IPython.display import display, Image\n", "from IPython.display import display, Image\n",
"from IPython.display import SVG" "from IPython.display import SVG"
] ]
@ -91,13 +86,35 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"ENCODING='FSK9k6'\n", "#ENCODING='APT'\n",
"#batch_size = 64\n", "#ENCODING='BPSK1k2' # Fail\n",
"#ENCODING='FSK9k6'\n",
"#ENCODING='FM'\n",
"ENCODING='GMSK2k4'\n",
"#ENCODING='GMSK4k8'\n",
"#ENCODING='USB'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#batch_size = 8\n",
"#atch_size = 16\n",
"#atch_size = 32\n",
"batch_size = 64\n",
"#batch_size = 128\n",
"#batch_size = 256\n",
"#epochs = 4\n", "#epochs = 4\n",
"batch_size = 128\n", "epochs = 8\n",
"epochs = 4\n", "#IMG_WIDTH = 208\n",
"#IMG_HEIGHT = 402\n",
"IMG_WIDTH = 416\n", "IMG_WIDTH = 416\n",
"IMG_HEIGHT = 803" "IMG_HEIGHT = 803\n",
"#IMG_WIDTH = 823\n",
"#IMG_HEIGHT = 1603"
] ]
}, },
{ {
@ -133,9 +150,9 @@
"print('Validation bad images: ', num_val_bad)\n", "print('Validation bad images: ', num_val_bad)\n",
"print('Validation images: ', total_val)\n", "print('Validation images: ', total_val)\n",
"print('')\n", "print('')\n",
"print('Reduce training and validation set')\n", "#print('Reduce training and validation set')\n",
"total_train = 5000\n", "#total_train = 1000\n",
"total_val = 5000\n", "#total_val = 1000\n",
"print('Training reduced to: ', total_train)\n", "print('Training reduced to: ', total_train)\n",
"print('Validation reduced to: ', total_val)" "print('Validation reduced to: ', total_val)"
] ]
@ -390,7 +407,9 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [], "outputs": [],
"source": [ "source": [
"loss = history.history['loss']\n", "loss = history.history['loss']\n",
@ -398,8 +417,10 @@
"\n", "\n",
"epochs_range = range(epochs)\n", "epochs_range = range(epochs)\n",
"\n", "\n",
"save_plot_dir = os.path.join('/srv/satnogs/data/models/', ENCODING)\n",
"os.makedirs(save_plot_dir, exist_ok=True)\n",
"plot_file=(\"wut-plot-\" + ENCODING + \".png\")\n", "plot_file=(\"wut-plot-\" + ENCODING + \".png\")\n",
"save_path_plot = os.path.join('/srv/satnogs/data/models/', ENCODING, plot_file)\n", "save_path_plot = os.path.join(save_plot_dir, plot_file)\n",
"print(save_path_plot)\n", "print(save_path_plot)\n",
"\n", "\n",
"plt.figure(figsize=(8, 8))\n", "plt.figure(figsize=(8, 8))\n",
@ -491,6 +512,13 @@
"source": [ "source": [
"#SVG(model_to_dot(model).create(prog='dot', format='svg'))" "#SVG(model_to_dot(model).create(prog='dot', format='svg'))"
] ]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {

View File

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -13,7 +13,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -22,7 +22,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -31,7 +31,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -47,24 +47,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"Start\n"
]
}
],
"source": [ "source": [
"print(\"Start\")" "print(\"Start\")"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -73,7 +65,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -82,7 +74,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -91,7 +83,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -116,7 +108,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -129,7 +121,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -139,7 +131,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -152,7 +144,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -162,24 +154,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"Python import done\n"
]
}
],
"source": [ "source": [
"print(\"Python import done\")" "print(\"Python import done\")"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -190,7 +174,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -200,7 +184,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -210,7 +194,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -220,7 +204,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -230,7 +214,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -239,7 +223,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -249,20 +233,9 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 26, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"total training good images: 16739\n",
"total training bad images: 3961\n",
"--\n",
"Total training images: 20700\n"
]
}
],
"source": [ "source": [
"print('total training good images:', num_train_good)\n", "print('total training good images:', num_train_good)\n",
"print('total training bad images:', num_train_bad)\n", "print('total training bad images:', num_train_bad)\n",
@ -272,20 +245,9 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27, "execution_count": null,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"total validation good images: 16716\n",
"total validation bad images: 3934\n",
"--\n",
"Total validation images: 20650\n"
]
}
],
"source": [ "source": [
"print('total validation good images:', num_val_good)\n", "print('total validation good images:', num_val_good)\n",
"print('total validation bad images:', num_val_bad)\n", "print('total validation bad images:', num_val_bad)\n",