New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

had to add line to retrain.py file to get model accuracy. must be better way. #3

Closed
mariochampion opened this Issue Dec 20, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@mariochampion
Copy link
Owner

mariochampion commented Dec 20, 2017

fully acknowledging it is not a best practice, i added a line to tensorflow's retrain.py script because i could not get stdout=subprocess.PIPE or any close permutation to work. and although tf.logging says it prints to stdout, there is an github issue that disputes that, along with stackexchange conversation and my experience.

See tensorflow/tensorflow#3047
See https://stackoverflow.com/questions/4760215/running-shell-command-from-python-and-capturing-the-output
See https://stackoverflow.com/questions/6657690/python-getoutput-equivalent-in-subprocess

therefore, the add_accuracy_to_modeldir() function in robo_tfretrain.py relies on pulling the model accuracy from the "retrained_labels.txt" file generated at the end of tensorflow's retraining. i glommed onto that file creation to add accuracy to a line at the end of that file, then use add_accuracy_to_modeldir() to grab it, and delete it from the file.

the added line is literally the last line in retrain.py's main() function. around line 1144 i added:

f.write(str("_acc"+str(test_accuracy*100)[:5]) + '\n')

BUT I WOULD LOVE to just grab it from tf.logging.info and/or stdout or anything that doesnt require a change to a file i didnt create...

suggestions welcomed!!

@mariochampion

This comment has been minimized.

Copy link
Owner

mariochampion commented Feb 2, 2018

resolved!! see pr #31
and comment about stderr not stdout.. bam!
training_results = Popen(cmds,shell=False,stderr=PIPE,bufsize=1,executable="python")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment