Skip to content

Commit

Permalink
rename file_extensions to file_extension
Browse files Browse the repository at this point in the history
  • Loading branch information
rasbt committed Jan 18, 2019
1 parent 5ab6726 commit 72437b9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
34 changes: 18 additions & 16 deletions docs/sources/user_guide/image/eyepad_align.ipynb
Expand Up @@ -189,14 +189,14 @@
"name": "stderr",
"output_type": "stream",
"text": [
"0% [##### ] 100% | ETA: 00:00:00/Users/sebastian/Desktop/eyepad_mlxtend/mlxtend/image/extract_face_landmarks.py:61: UserWarning: No face detected.\n",
"0% [##### ] 100% | ETA: 00:00:00/Users/sebastian/code/mlxtend/mlxtend/image/extract_face_landmarks.py:61: UserWarning: No face detected.\n",
" warnings.warn('No face detected.')\n",
"/Users/sebastian/Desktop/eyepad_mlxtend/mlxtend/image/eyepad_align.py:153: UserWarning: No face detected in image 000004.jpg. Image ignored.\n",
" warnings.warn('No face detected in image %s. Image ignored.' % f)\n",
"/Users/sebastian/code/mlxtend/mlxtend/image/eyepad_align.py:160: UserWarning: No face detected in image 000004.jpg. Image ignored.\n",
" % f)\n",
"0% [#########] 100% | ETA: 00:00:00\n",
"Total time elapsed: 00:00:00\n",
"/Users/sebastian/Desktop/eyepad_mlxtend/mlxtend/image/eyepad_align.py:153: UserWarning: No face detected in image 000003.jpg. Image ignored.\n",
" warnings.warn('No face detected in image %s. Image ignored.' % f)\n"
"/Users/sebastian/code/mlxtend/mlxtend/image/eyepad_align.py:160: UserWarning: No face detected in image 000003.jpg. Image ignored.\n",
" % f)\n"
]
},
{
Expand All @@ -217,7 +217,7 @@
"\n",
"eyepad.fit_directory(target_img_dir='celeba-subset/',\n",
" target_width=178, target_height=218,\n",
" file_extensions='.jpg')\n",
" file_extension='.jpg')\n",
"\n",
"img = imageio.imread('test-face.png')\n",
"img_tr = eyepad.transform(img)\n",
Expand Down Expand Up @@ -444,20 +444,20 @@
"name": "stderr",
"output_type": "stream",
"text": [
"0% [##### ] 100% | ETA: 00:00:00/Users/sebastian/Desktop/eyepad_mlxtend/mlxtend/image/extract_face_landmarks.py:61: UserWarning: No face detected.\n",
"0% [##### ] 100% | ETA: 00:00:00/Users/sebastian/code/mlxtend/mlxtend/image/extract_face_landmarks.py:61: UserWarning: No face detected.\n",
" warnings.warn('No face detected.')\n",
"/Users/sebastian/Desktop/eyepad_mlxtend/mlxtend/image/eyepad_align.py:153: UserWarning: No face detected in image 000004.jpg. Image ignored.\n",
" warnings.warn('No face detected in image %s. Image ignored.' % f)\n",
"/Users/sebastian/code/mlxtend/mlxtend/image/eyepad_align.py:160: UserWarning: No face detected in image 000004.jpg. Image ignored.\n",
" % f)\n",
"0% [#########] 100% | ETA: 00:00:00\n",
"Total time elapsed: 00:00:00\n",
"/Users/sebastian/Desktop/eyepad_mlxtend/mlxtend/image/eyepad_align.py:153: UserWarning: No face detected in image 000003.jpg. Image ignored.\n",
" warnings.warn('No face detected in image %s. Image ignored.' % f)\n"
"/Users/sebastian/code/mlxtend/mlxtend/image/eyepad_align.py:160: UserWarning: No face detected in image 000003.jpg. Image ignored.\n",
" % f)\n"
]
},
{
"data": {
"text/plain": [
"<mlxtend.image.eyepad_align.EyepadAlign at 0x1c16c83a20>"
"<mlxtend.image.eyepad_align.EyepadAlign at 0x1c169076a0>"
]
},
"execution_count": 10,
Expand All @@ -476,7 +476,7 @@
"\n",
"eyepad.fit_directory(target_img_dir='celeba-subset/',\n",
" target_width=178, target_height=218,\n",
" file_extensions='.jpg')"
" file_extension='.jpg')"
]
},
{
Expand Down Expand Up @@ -597,12 +597,14 @@
" in the target landmarks.\n",
"\n",
"\n",
"- `target_width_` : the width of the transformed output image.\n",
"- `target_height_` : the height of the transformed output image.\n",
"\n",
"\n",
"\n",
"- `target_height_` : the height of the transformed output image.\n",
"- `target_width_` : the width of the transformed output image.\n",
"\n",
"\n",
" file_extension str (default='.jpg'): File extension of the image files.\n",
"\n",
"For more usage examples, please see\n",
"[http://rasbt.github.io/mlxtend/user_guide/image/EyepadAlign/](http://rasbt.github.io/mlxtend/user_guide/image/EyepadAlign/)\n",
Expand All @@ -616,7 +618,7 @@
"\n",
"<hr>\n",
"\n",
"*fit_directory(target_img_dir, target_height, target_width, file_extensions='.jpg')*\n",
"*fit_directory(target_img_dir, target_height, target_width, file_extension='.jpg')*\n",
"\n",
"Calculates the average landmarks for all face images\n",
"in a directory which will then be set as the target landmark set.\n",
Expand Down
8 changes: 4 additions & 4 deletions mlxtend/image/eyepad_align.py
Expand Up @@ -57,7 +57,7 @@ class EyepadAlign(object):
target_width_ : the width of the transformed output image.
file_extensions : str (default='.jpg'): File extension of the image files.
file_extension str (default='.jpg'): File extension of the image files.
For more usage examples, please see
http://rasbt.github.io/mlxtend/user_guide/image/EyepadAlign/
Expand Down Expand Up @@ -94,7 +94,7 @@ def fit_image(self, target_image):
return self

def fit_directory(self, target_img_dir, target_height,
target_width, file_extensions='.jpg'):
target_width, file_extension='.jpg'):
"""
Calculates the average landmarks for all face images
in a directory which will then be set as the target landmark set.
Expand Down Expand Up @@ -122,11 +122,11 @@ def fit_directory(self, target_img_dir, target_height,
target_img_dir)
for (dirpath, dirnames, filenames)
in os.walk(target_img_dir)
for f in filenames if f.endswith(file_extensions)]
for f in filenames if f.endswith(file_extension)]

if not len(file_list):
raise ValueError('No images found in %s with extension %s.'
% (target_img_dir, file_extensions))
% (target_img_dir, file_extension))

if self.verbose >= 1:
print("Fitting the average facial landmarks "
Expand Down
4 changes: 2 additions & 2 deletions mlxtend/image/tests/test_eyepad_align.py
Expand Up @@ -51,7 +51,7 @@ def test_fit2dir():
eyepad.fit_directory(target_img_dir=os.path.join(path, 'celeba-subset/'),
target_width=178,
target_height=218,
file_extensions='.jpg')
file_extension='.jpg')

img = imageio.imread(os.path.join(path, 'lena-small.png'))

Expand Down Expand Up @@ -89,6 +89,6 @@ def tmp_func():
'celeba-subset/'),
target_width=178,
target_height=218,
file_extensions='.PNG')
file_extension='.PNG')

assert_raises(ValueError, tmp_func)

0 comments on commit 72437b9

Please sign in to comment.