As tutorial says,for getting down-sized pics we should run build_database.py.However,a small problem occurred because Linux and Windows use different file directory separation mark.Function below should change filename.split('/')[-1])) into filename.split('\\')[-1])) while using Windows.
def resize_and_save(filename, output_dir, size=SIZE):
"""Resize the image contained in `filename` and save it to the `output_dir`"""
image = Image.open(filename)
# Use bilinear interpolation instead of the default "nearest neighbor" method
image = image.resize((size, size), Image.BILINEAR)
image.save(os.path.join(output_dir, filename.split('/')[-1]))
As tutorial says,for getting down-sized pics we should run build_database.py.However,a small problem occurred because Linux and Windows use different file directory separation mark.Function below should change
filename.split('/')[-1]))
intofilename.split('\\')[-1]))
while using Windows.