-
Notifications
You must be signed in to change notification settings - Fork 0
/
image_labelling.sh
32 lines (27 loc) · 1.11 KB
/
image_labelling.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Path to checkpoint file or a directory containing checkpoint files. Passing
# a directory will only work if there is also a file named 'checkpoint' which
# lists the available checkpoints in the directory. It will not work if you
# point to a directory with just a copy of a model checkpoint: in that case,
# you will need to pass the checkpoint path explicitly.
CHECKPOINT_PATH="im2txt/model/model.ckpt-2000000"
# Vocabulary file generated by the preprocessing script.
VOCAB_FILE="im2txt/model/word_counts.txt"
# cd im2txt/data
# python3 rotate.py
# cd ../..
# JPEG image file to caption.
IMAGE_FILE="im2txt/data/image.jpg"
# Build the inference binary.
bazel build -c opt //im2txt:run_inference
# Ignore GPU devices (only necessary if your GPU is currently memory
# constrained, for example, by running the training script).
export CUDA_VISIBLE_DEVICES=""
# Run inference to generate captions.
bazel-bin/im2txt/run_inference \
--checkpoint_path=${CHECKPOINT_PATH} \
--vocab_file=${VOCAB_FILE} \
--input_files=${IMAGE_FILE} > output.txt
echo "Output goes below:"
cat output.txt
python3 talk.py < output.txt
rm output.txt