0

train.sh:

make_image_classifier \
    --image_dir ./training_data \
    --tfhub_module https://tfhub.dev/google/tf2-preview/mobilenet_v2/classification/4 \
    --image_size 224 \
    --saved_model_dir ./results/saved_model \
    --labels_output_file ./results/labels/class_labels.txt \
    --summaries_dir ./results/logs \
    --learning_rate 0.01 \
    --batch_size 20 \
    --train_epochs 6 \
    --validation_split 0.1 \
    --assert_accuracy_at_least 0.9

For some reason it only runs the first line?

It definitely works though if I put it all in one single line without \:

make_image_classifier --image_dir ./training_data --tfhub_module https://tfhub.dev/google/tf2-preview/mobilenet_v2/classification/4 --image_size 224 --saved_model_dir ./results/saved_model --labels_output_file ./results/labels/class_labels.txt --summaries_dir ./results/logs --learning_rate 0.01 --batch_size 20 --train_epochs 5 --validation_split 0.1 --assert_accuracy_at_least 0.9

But of course it's messy so I prefer not to use it.

Any ideas what I might be missing?

Thanks!

mashedpotatoes
  • 395
  • 2
  • 20
  • 1
    Is there a blank after any of the backslashes? – Benjamin W. Nov 27 '20 at 00:37
  • 2
    Could also be DOS newlines instead of UNIX ones, but that's not the case as it's copied-and-pasted into here. Which is to say: The code **in the question** is perfectly fine; the question is whether it's a mismatch for the code you're actually running in some subtle way. – Charles Duffy Nov 27 '20 at 00:43
  • 1
    If you run `bash -x yourscript`, what exactly does it log? – Charles Duffy Nov 27 '20 at 00:43
  • 1
    As proof of what I asserted above (that the above doesn't reproduce the stated problem), see https://ideone.com/Sc3nlv, running your code in an online interpreter. As you can see, all the arguments are passed to the command. – Charles Duffy Nov 27 '20 at 00:44
  • 1
    ...however, if every backslash had a hidden `$'\r'` after it (which is the CR character in DOS/Windows CRLF-style newlines, whereas UNIX ones are just LFs), that explains the problem perfectly: The backslash is treated as escaping the CR, not the LF (which is what _UNIX_ recognizes as a newline). To fix this, in vim, run `:set fileformat=unix`; or use the `dos2unix` command-line tool; or see one of the many other approaches given to fixing it in the linked duplicate. – Charles Duffy Nov 27 '20 at 00:46
  • For some reason the text editor I'm using does indeed use DOS newlines. Weird. Thank you though! – mashedpotatoes Nov 27 '20 at 03:26

0 Answers0