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",
"# https://spacecruft.org/spacecruft/satnogs-wut\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/"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# GPLv3+"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Reads wut.h5 and tests files in data/test/unvetted/\n",
"#\n",
"# GPLv3+\n",
"#\n",
"# Built using Jupyter, Tensorflow, Keras"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"print(\"Start\")"
]
},
{
"cell_type": "code",
"execution_count": null,
@ -131,7 +106,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"Python import done\")"
"ENCODING='FSK9k6'"
]
},
{
@ -140,7 +115,9 @@
"metadata": {},
"outputs": [],
"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": {},
"outputs": [],
"source": [
"#model = load_model('data/models/wut-DUV.tf')\n",
"model = load_model('/srv/satnogs/data/models/CW/wut-CW.h5')"
"model = load_model(model_path_h5)"
]
},
{
@ -159,16 +135,9 @@
"metadata": {},
"outputs": [],
"source": [
"test_dir = os.path.join('/srv/satnogs/data/', 'test')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"num_test = len(os.listdir(test_dir))"
"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)"
]
},
{
@ -178,11 +147,11 @@
"outputs": [],
"source": [
"# Good results\n",
"#batch_size = 128\n",
"#epochs = 6\n",
"batch_size = 128\n",
"epochs = 6\n",
"# Testing, faster more inaccurate results\n",
"batch_size = 32\n",
"epochs = 3"
"#batch_size = 32\n",
"#epochs = 3"
]
},
{
@ -210,15 +179,6 @@
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(test_dir)"
]
},
{
"cell_type": "code",
"execution_count": null,
@ -242,6 +202,15 @@
"sample_test_images, _ = next(test_data_gen)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(num_test)"
]
},
{
"cell_type": "code",
"execution_count": null,
@ -265,28 +234,7 @@
"metadata": {},
"outputs": [],
"source": [
"plotImages(sample_test_images[0:3])"
]
},
{
"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)"
"plotImages(sample_test_images[0:2])"
]
},
{
@ -298,8 +246,7 @@
"prediction = model.predict(\n",
" x=test_data_gen,\n",
" verbose=1\n",
")\n",
"print(\"end predict\")"
")"
]
},
{
@ -317,7 +264,6 @@
"metadata": {},
"outputs": [],
"source": [
"# Show prediction score\n",
"print(prediction)"
]
},
@ -355,22 +301,6 @@
" rating = 'good'\n",
"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": {