Reputation: 233
I am trying to understand TenserFlow image classification. Got following code from GitHub, starts from 298 line in "retrain.py" script.
dest_directory = FLAGS.model_dir
if not os.path.exists(dest_directory):
os.makedirs(dest_directory)
What does "FLAGS.model_dir"
mean and where is this directory located?
Upvotes: 1
Views: 705
Reputation: 53758
FLAGS
holds parsed command line arguments. This script uses argparse
library, but the style is inherited from gflags library, originally developed internally at Google in C++, then open sources and ported to different languages.
What FLAGS.model_dir
means is easy to see from the parser definitions:
parser.add_argument(
'--model_dir',
type=str,
default='/tmp/imagenet',
help="""\
Path to classify_image_graph_def.pb,
imagenet_synset_to_human_label_map.txt, and
imagenet_2012_challenge_label_map_proto.pbtxt.\
"""
)
So, its location is specified by the user when she runs the script. If nothing it specified, this path is used: '/tmp/imagenet'
.
Upvotes: 2