in baselines/gist_baseline.py [0:0]
def extract_from_image_list(self, imlist, outfile):
execfile = self.execname
assert os.path.exists(execfile), (
"executable %s does not exist, " % execfile
+ "please do: make in the excutable directory"
)
f = subprocess.Popen(
[execfile, "-o", outfile],
text=False,
stdin=subprocess.PIPE, stdout=subprocess.DEVNULL
)
for i, imname in enumerate(imlist):
if i < 100 or i % 100 == 0:
print(f"processing {i}/{len(imlist)} {imname}", end="\r", flush=True)
im = Image.open(imname)
if im.mode != "RGB":
im = im.convert('RGB')
im = self.preproc_image(im)
im.save(f.stdin, format="ppm")
f.stdin.close()
f.wait()