python show an image via subprocess.Popen
import tensorflow as tf
import Image
import os
import subprocess
def main(argv):
folder = argv[0]
if (len(argv) > 1):
if tf.gfile.Exists(argv[1]):
folder = argv[1]
else:
print ('%s not existed' % argv[1])
return
else:
print ("please input training image data folder path")
return
for f in tf.gfile.ListDirectory(folder):
filepath = os.path.join(folder, f)
try:
im = Image.open(filepath)
p = subprocess.Popen(["display", filepath])
label = raw_input("please label the image, 0 means cat, 1 means dog:")
p.kill()
except Exception, e:
print (e)
import Image
import os
import subprocess
def main(argv):
folder = argv[0]
if (len(argv) > 1):
if tf.gfile.Exists(argv[1]):
folder = argv[1]
else:
print ('%s not existed' % argv[1])
return
else:
print ("please input training image data folder path")
return
for f in tf.gfile.ListDirectory(folder):
filepath = os.path.join(folder, f)
try:
im = Image.open(filepath)
p = subprocess.Popen(["display", filepath])
label = raw_input("please label the image, 0 means cat, 1 means dog:")
p.kill()
except Exception, e:
print (e)
Comments
Post a Comment