Description
Multiple files across models/official/ use hardcoded /tmp/ paths as default values in flag definitions. This is not portable across platforms and can cause confusion or silent failures.
Affected files
EfficientNet — models/official/efficientnet/eval_ckpt_main.py
flags.DEFINE_string('ckpt_dir', '/tmp/ckpt/', ...)
flags.DEFINE_string('example_img', '/tmp/panda.jpg', ...)
flags.DEFINE_string('labels_map_file', '/tmp/labels_map.txt', ...)
EfficientNet — models/official/efficientnet/inspect_model_architecture.py
flags.DEFINE_string('output_tflite', '/tmp/model.tflite', ...)
MnasNet — models/official/mnasnet/eval_ckpt_main.py
flags.DEFINE_string('ckpt_dir', '/tmp/ckpt/', ...)
flags.DEFINE_string('example_img', '/tmp/panda.jpg', ...)
flags.DEFINE_string('labels_map_file', '/tmp/labels_map.txt', ...)
Detection — models/official/detection/inference.py, inference_saved_model.py
flags.DEFINE_string('output_html', '/tmp/test.html', ...)
Fashionpedia — models/official/detection/projects/fashionpedia/inference.py, inference_saved_model.py
flags.DEFINE_string('output_html', '/tmp/test.html', ...)
flags.DEFINE_string('output_file', '/tmp/res.npy', ...)
Impact
- Not portable to Windows or environments where
/tmp may not be writable
- Users may unknowingly overwrite each other's files in shared environments
- Defaults like
/tmp/panda.jpg imply a file exists there, with no guidance on how to obtain it
Suggested Fix
Use None as the default and require the user to specify paths explicitly, or use tempfile.mkdtemp() / platform-agnostic alternatives.
Description
Multiple files across
models/official/use hardcoded/tmp/paths as default values in flag definitions. This is not portable across platforms and can cause confusion or silent failures.Affected files
EfficientNet —
models/official/efficientnet/eval_ckpt_main.pyEfficientNet —
models/official/efficientnet/inspect_model_architecture.pyMnasNet —
models/official/mnasnet/eval_ckpt_main.pyDetection —
models/official/detection/inference.py,inference_saved_model.pyFashionpedia —
models/official/detection/projects/fashionpedia/inference.py,inference_saved_model.pyImpact
/tmpmay not be writable/tmp/panda.jpgimply a file exists there, with no guidance on how to obtain itSuggested Fix
Use
Noneas the default and require the user to specify paths explicitly, or usetempfile.mkdtemp()/ platform-agnostic alternatives.