Fix paths, predict misc

master
Jeff Moe 2022-08-16 21:32:01 -06:00
parent ec25b09b24
commit 33adccb2cb
1 changed files with 27 additions and 97 deletions

View File

@ -10,38 +10,13 @@
"#\n", "#\n",
"# https://spacecruft.org/spacecruft/satnogs-wut\n", "# https://spacecruft.org/spacecruft/satnogs-wut\n",
"# Based on data/train and data/val directories builds a wut.h5 file.\n", "# Based on data/train and data/val directories builds a wut.h5 file.\n",
"# Reads wut.h5 and tests files in data/test/unvetted/" "# Reads wut.h5 and tests files in data/test/unvetted/\n",
] "#\n",
}, "# GPLv3+\n",
{ "#\n",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# GPLv3+"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Built using Jupyter, Tensorflow, Keras" "# Built using Jupyter, Tensorflow, Keras"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"print(\"Start\")"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@ -131,7 +106,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"print(\"Python import done\")" "ENCODING='FSK9k6'"
] ]
}, },
{ {
@ -140,7 +115,9 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"print(\"Load HDF file\")" "h5_file=(\"wut-\" + ENCODING + \".h5\")\n",
"model_path_h5 = os.path.join('/srv/satnogs/data/models/', ENCODING, h5_file)\n",
"print(model_path_h5)"
] ]
}, },
{ {
@ -149,8 +126,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"#model = load_model('data/models/wut-DUV.tf')\n", "model = load_model(model_path_h5)"
"model = load_model('/srv/satnogs/data/models/CW/wut-CW.h5')"
] ]
}, },
{ {
@ -159,16 +135,9 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"test_dir = os.path.join('/srv/satnogs/data/', 'test')" "test_dir = os.path.join('/srv/satnogs/data/', 'test')\n",
] "num_test = len(os.listdir(test_dir))\n",
}, "print(\"Will test\", num_test, \"waterfall PNG files under this driectory:\\n\", test_dir)"
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"num_test = len(os.listdir(test_dir))"
] ]
}, },
{ {
@ -178,11 +147,11 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"# Good results\n", "# Good results\n",
"#batch_size = 128\n", "batch_size = 128\n",
"#epochs = 6\n", "epochs = 6\n",
"# Testing, faster more inaccurate results\n", "# Testing, faster more inaccurate results\n",
"batch_size = 32\n", "#batch_size = 32\n",
"epochs = 3" "#epochs = 3"
] ]
}, },
{ {
@ -210,15 +179,6 @@
")" ")"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(test_dir)"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@ -242,6 +202,15 @@
"sample_test_images, _ = next(test_data_gen)" "sample_test_images, _ = next(test_data_gen)"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(num_test)"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@ -265,28 +234,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"plotImages(sample_test_images[0:3])" "plotImages(sample_test_images[0:2])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# https://keras.io/models/sequential/\n",
"print(\"predict\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#pred=model.predict_generator(test_data_gen,\n",
"#steps=1,\n",
"#verbose=1)"
] ]
}, },
{ {
@ -298,8 +246,7 @@
"prediction = model.predict(\n", "prediction = model.predict(\n",
" x=test_data_gen,\n", " x=test_data_gen,\n",
" verbose=1\n", " verbose=1\n",
")\n", ")"
"print(\"end predict\")"
] ]
}, },
{ {
@ -317,7 +264,6 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"# Show prediction score\n",
"print(prediction)" "print(prediction)"
] ]
}, },
@ -355,22 +301,6 @@
" rating = 'good'\n", " rating = 'good'\n",
"print('Observation: %s' % (rating))" "print('Observation: %s' % (rating))"
] ]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# The End"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {