Environnement d'exploitation
GeForce GTX 1070 (8GB)
ASRock Z170M Pro4S [Intel Z170chipset]
Ubuntu 16.04 LTS desktop amd64
TensorFlow v1.1.0
cuDNN v5.1 for Linux
CUDA v8.0
Python 3.5.2
IPython 6.0.0 -- An enhanced Interactive Python.
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
bash> Conversion TFRerocds de fichiers dans plusieurs répertoires (traitement individuel) http://qiita.com/7of9/items/6f6ffdb7dbcebdc8d923 Implémentation du processus de collecte des TFRecords de plusieurs répertoires créés dans.
Tout d'abord, récupérez la liste des fichiers.
Il semble utiliser glob. http://www.yukun.info/blog/2008/08/python-directory-listdir-glob.html Merci pour l'information.
combine_TFRecords_170722.py
import glob
"""
v0.1 Jul. 22, 2017
- get file list
"""
# codingrule:PEP8
res = glob.glob("../run*/IntField-Y_170709.tfrecords")
for elem in res:
print(elem)
$ python3 combine_TFRecords_170722.py
../run366_sphere_g26_m1.45/IntField-Y_170709.tfrecords
../run375_sphere_g26_m1.5/IntField-Y_170709.tfrecords
../run354_sphere_g26_m1.33/IntField-Y_170709.tfrecords
../run362_sphere_g26_m1.4/IntField-Y_170709.tfrecords
../run364_sphere_g26_m1.4/IntField-Y_170709.tfrecords
../run368_sphere_g26_m1.45/IntField-Y_170709.tfrecords
../run370_sphere_g26_m1.45/IntField-Y_170709.tfrecords
../run376_sphere_g26_m1.5/IntField-Y_170709.tfrecords
../run367_sphere_g26_m1.45/IntField-Y_170709.tfrecords
../run356_sphere_g26_m1.33/IntField-Y_170709.tfrecords
../run372_sphere_g26_m1.5/IntField-Y_170709.tfrecords
../run355_sphere_g26_m1.33/IntField-Y_170709.tfrecords
../run360_sphere_g26_m1.4/IntField-Y_170709.tfrecords
../run373_sphere_g26_m1.5/IntField-Y_170709.tfrecords
../run365_sphere_g26_m1.45/IntField-Y_170709.tfrecords
../run369_sphere_g26_m1.45/IntField-Y_170709.tfrecords
../run353_sphere_g26_m1.33/IntField-Y_170709.tfrecords
../run357_sphere_g26_m1.33/IntField-Y_170709.tfrecords
../run371_sphere_g26_m1.5/IntField-Y_170709.tfrecords
../run359_sphere_g26_m1.4/IntField-Y_170709.tfrecords
../run358_sphere_g26_m1.33/IntField-Y_170709.tfrecords
../run374_sphere_g26_m1.5/IntField-Y_170709.tfrecords
../run363_sphere_g26_m1.4/IntField-Y_170709.tfrecords
../run361_sphere_g26_m1.4/IntField-Y_170709.tfrecords
(Ajout 2017/10/03)
Référence: https://stackoverflow.com/questions/6773584/how-is-pythons-glob-glob-ordered
L'ordre dans l'exécution de glob.glob () sera le même que celui de ls -U
.
Utilisez sort () pour trier par heure de modification.
import os
sorted(glob.glob('*.png'), key=os.path.getmtime)
Recommended Posts