Search code examples
machine-learningtensorflowbazel

How to run the preprocessing script using bazel?


I am trying to prepare the training data for im2txt tensorflow model.
I have installed bazel-0.4.3 and added it to env path.
In order to prepare the training data, I have tried this in the command window:

C:\Users\Akriti\Downloads\im2txt>set MSCOCO_DIR=c:/im2txt/data/mscoco 

Later

C:\Users\Akriti\Downloads\im2txt>bazel build //im2txt:download_and_preprocess_mscoco

Log Info:

INFO: Found 1 target...  
Target //im2txt:download_and_preprocess_mscoco up-to-date:  
C:/Users/Akriti/AppData/Local/Temp/_bazel_Akriti/$3vD$Qgm/execroot/im2txt/bazel-out/local-fastbuild/bin/im2txt/download_and_preprocess_mscoco  
INFO: Elapsed time: 8.063s, Critical Path: 0.05s  

Next When I tried

C:\Users\Akriti\Downloads\im2txt>bazel-bin/im2txt/download_and_preprocess_mscoco "${MSCOCO_DIR}"

I am getting:

'bazel-bin' is not recognized as an internal or external command, operable program or batch file.

How do I proceed with preparing the training data?

Link to the tensorflow model: https://github.com/tensorflow/models/tree/master/im2txt


Solution

  • According to https://github.com/tensorflow/models/blob/master/im2txt/im2txt/BUILD#L22

    //im2txt:download_and_preprocess_mscoco
    

    is a sh_binary, so you cannot run it under cmd.exe You can try to run it under MSYS on Windows.

    For the error you got, that's because you should use backslash in path when running a binary under cmd.exe. Like this:

    bazel-bin\im2txt\download_and_preprocess_mscoco