2016-10-25 4 views
3

im2txtを使って同じフォルダに保存されている数千のjpegイメージのキャプションを生成できるかどうかを知りたいだけです。私はちょうどそのようなものと一緒に行くべきですか?キャプションを生成し、結果を.txtファイルに書き出します。im2txtで大きなjpegセットをキャプションする

# Directory containing model checkpoints. 
CHECKPOINT_DIR="${HOME}/im2txt/model/train" 

# Vocabulary file generated by the preprocessing script. 
VOCAB_FILE="${HOME}/im2txt/data/mscoco/word_counts.txt" 

# JPEG image file to caption. 
IMAGE_FILE="${HOME}/im2txt/data/lotofimages/ 

# 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 >> 1.txt \ 
    --checkpoint_path=${CHECKPOINT_DIR} \ 
    --vocab_file=${VOCAB_FILE} \ 
    --input_files=${IMAGE_FILE} 

ありがとうございます!

+0

私はそれを忘れて使用する。// githubのを。 com/tensorflow/models/tree/master/im2txt –

答えて

0

私はfineallyそれを行うための最善の方法を見つけました:ここにim2txtのgithubのです - ます。https:ファイルパターン

.../yourimagesfolder/* JPG

1

私はそのようなアプローチを使用する:

IMAGE_FILE = "/パス/に/ image1.jpg、/パス/に/ image2.jpg /,...,/パス/ TO/image1000.jpg"

私は、ファイルscript.shにこのスクリプトを入れて、コマンドでそれを実行します。

./script.sh > captions.txt 

ファイルcaptions.txtは、すべての画像のためのすべてのキャプションが含まれています。

多分もっと良い方法がありますが、これは私のためにうまくいきます。

関連する問題