すべてのデータを保存するローカルディレクトリにdata
というフォルダを作成してから、./data
を使用して参照することができます。その後、地元のdata
フォルダにアクセスするには、次のように動作するはずです:
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("./data/", one_hot = True)
あなたはまた、プログラムでカレントディレクトリを取得することができ、その後、その後
import os
# get the current directory
current_directory = os.path.join(os.path.dirname(__file__))
# create the path to the data directory within the current directory
data_directory = os.path.join(current_directory, "data")
を次のようにデータディレクトリへのパスを構築し、
import os
from tensorflow.examples.tutorials.mnist import input_data
# get the current directory
current_directory = os.path.join(os.path.dirname(__file__))
# create the path to the data directory within the current directory
data_directory = os.path.join(current_directory, "data")
mnist = input_data.read_data_sets(data_directory, one_hot = True)
EDIT:次のようにコードを編集してあなたのコメントをもとに、あなたは、TEで独自のデータをロードする方法について尋ねていますnsorflow:
あなたはそれがこのチュートリアルを開始するために、より良いのTFを初めて使用する場合は、ドキュメントで推奨されているように:
のファイルを読み取るための以下のコードを使用しますそこからinput_dataをインポートします。次に、 "mnist = input_data.read_data_sets(" ./ data/"、one_hot = True)"という行は、 "data"フォルダにデータをダウンロードします。あなたはそれを試すことができます。 私はこれをやりたいとは思わない、私はこのリンク上のデータ "tensorflow.examples.tutorials.mnist"以外のいくつかの訓練データを持っている。私のトレーニングデータはローカルディレクトリにあります。 –