kind of working

master 0.72
ml server 2020-01-24 16:40:37 -07:00
parent 18cc36dfa6
commit 709b7c53a3
1 changed files with 22 additions and 13 deletions

View File

@ -60,14 +60,11 @@
"print(\"wut is an AI that rates SatNOGS Observations good or bad.\")\n",
"print(\"The training model was built from DUV transmissions recorded by the\")\n",
"print(\"SatNOGS network in December, 2019.\")\n",
"print(\"When the page loads, the AI processes a random image and rates it good or bad.\")\n",
"print(\"The test pool has 500+ DUV waterfalls the AI hasn't seen before.\")\n",
"print(\"The plan is to have models of all SatNOGS modes (65 at present),\")\n",
"print(\"and you can enter an arbitrary Observation ID and the AI will return a rating.\")\n",
"print(\"\")\n",
"print(\"Source Code:\")\n",
"print(\"https://spacecruft.org/spacecruft/satnogs-wut\")\n",
"print(\"Alpha stage.\")"
"print(\"https://spacecruft.org/spacecruft/satnogs-wut\")"
]
},
{
@ -106,9 +103,8 @@
"outputs": [],
"source": [
"def wutObs(datObs):\n",
" if int(datObs) > ( minobsid - 1 ) and int(datObs) < maxobsid:\n",
" if int(datObs) > ( minobsid - 1 ) and int(datObs) < ( maxobsid + 1):\n",
" obsjsonfile=('/srv/satnogs/download/' + format(datObs) + '/' + format(datObs) + '.json')\n",
" !cat $obsjsonfile\n",
" with open(obsjsonfile) as f:\n",
" content = f.read()\n",
" data = json.loads(content)\n",
@ -116,18 +112,21 @@
" res2 = dict(enumerate(data))\n",
" obs_dict=(res2[0])\n",
" obs_id=(obs_dict['id'])\n",
" \n",
" obs_vetted_status=(obs_dict['vetted_status'])\n",
" obs_waterfallurl=(obs_dict['waterfall'])\n",
" obs_transmitter=(obs_dict['transmitter'])\n",
" obs_station_name=(obs_dict['station_name'])\n",
" obs_transmitter_mode=(obs_dict['transmitter_mode'])\n",
" \n",
" obs_waterfall=os.path.basename(obs_waterfallurl)\n",
" print('Observation ID: ', obs_id)\n",
" print('Human vetting:', obs_vetted_status)\n",
" obs_waterfall_path = os.path.join('/srv/satnogs/download', str(obs_id), obs_waterfall)\n",
" \n",
" tmp_dir = tempfile.mkdtemp()\n",
" test_dir = os.path.join(tmp_dir)\n",
" os.makedirs(test_dir + '/unvetted', exist_ok=True)\n",
" shutil.copy(obs_waterfall_path, test_dir + '/unvetted/')\n",
" img = im.open(obs_waterfall_path).resize( (75,150) )\n",
" display(img)\n",
" img = im.open(obs_waterfall_path).resize( (100,200) )\n",
" test_image_generator = ImageDataGenerator(\n",
" rescale=1./255\n",
" )\n",
@ -142,14 +141,24 @@
" predictions=[]\n",
" prediction_bool = (prediction >0.8)\n",
" predictions = prediction_bool.astype(int)\n",
" print('https://network.satnogs.org/observations/' + str(obs_id))\n",
" print('Observation ID: ', obs_id)\n",
" print('Human rating: ', obs_vetted_status)\n",
" print('Encoding: ', obs_transmitter_mode)\n",
" if obs_transmitter_mode == 'DUV':\n",
" print(\"Using DUV training model.\")\n",
" else:\n",
" print(\"NOTE: wut has not been trained on\", obs_transmitter_mode, \"encodings.\")\n",
" \n",
" \n",
" print('Human rating: ', obs_vetted_status)\n",
" if prediction_bool[0] == False:\n",
" rating = 'bad'\n",
" else:\n",
" rating = 'good'\n",
" print('wut AI rating: %s' % (rating))\n",
" shutil.rmtree(test_dir)"
" print('wut AI rating: %s' % (rating))\n",
" display(img)\n",
" shutil.rmtree(test_dir)\n",
" #!cat $obsjsonfile"
]
},
{