Skip to content

Commit

Permalink
Merge pull request #175 from cosanlab/dev
Browse files Browse the repository at this point in the history
WIP Fixes
  • Loading branch information
ejolly authored Aug 15, 2023
2 parents ac9681d + 5e7569c commit f1073c1
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests_and_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
# OSs to test
os: [ubuntu-latest, macos-latest, windows-latest]
# Python versions to test
python-version: [3.7, 3.8, 3.9]
python-version: [3.8, 3.9, "3.10"]
# By default everything should pass for the workflow to pass
ok-fail: [false]
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_on_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
# OSs to test
os: [ubuntu-latest, macos-latest, windows-latest]
# Python versions to test
python-version: [3.7, 3.8, 3.9]
python-version: [3.8, 3.9, "3.10"]
# By default everything should pass for the workflow to pass
ok-fail: [false]
steps:
Expand Down
4 changes: 2 additions & 2 deletions docs/basic_tutorials/04_plotting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"# 4. Visualizing Facial Expressions\n",
"*written by Eshin Jolly*\n",
"\n",
"In this tutorial we'll explore plotting in Py-Feat using functions from the `feat.plotting` module along with plotting methods using the Fex data class. You can try it out interactively in Google Collab: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/cosanlab/py-feat/blob/master/notebooks/content/05_plotting.ipynb)\n",
"In this tutorial we'll explore plotting in Py-Feat using functions from the `feat.plotting` module along with plotting methods using the Fex data class. You can try it out interactively in Google Collab: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/cosanlab/py-feat/blob/master/notebooks/content/04_plotting.ipynb)\n",
"\n",
"\n",
"To help visualize facial expressions in a standardized way, Py-Feat includes a pre-trained partial-least-squares (PLS) model that can map between an array of AU intensities (between 0-N) and facial landmark coordinates. Just pass in a numpy array of AU intensities to the `plot_face()` function to visualize the resulting facial expression. In general we find that a 4 by 5 aspect ratio seems to work best when plotting faces (default in `plot_face()`).\n",
Expand Down Expand Up @@ -620,7 +620,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.12"
"version": "3.8.13"
},
"toc": {
"base_numbering": 1,
Expand Down
12 changes: 12 additions & 0 deletions docs/pages/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Change Log

# 0.6.1

## Notes

This version **drops support for Python 3.7** and fixes several dependency related issues:

- [#162](https://github.com/cosanlab/py-feat/issues/162)
- [#176](https://github.com/cosanlab/py-feat/issues/176)
- We can now handle images with an alpha-channel by just grabbing the RGB channels (typically in png files)
- Update minimum `scikit-learn` version requirement to ensure our viz models are loaded correctly
- Soft-pin `numexpr` version until this upstream pandas issue is [fixed](https://github.com/pandas-dev/pandas/issues/54449)

# 0.6.0

## Notes
Expand Down
4 changes: 4 additions & 0 deletions feat/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1914,6 +1914,10 @@ def __getitem__(self, idx):
img = Image.open(self.images[idx])
img = transforms.PILToTensor()(img)

# Drop alpha channel
if img.shape[0] == 4:
img = img[:3, ...]

if img.shape[0] == 1:
img = torch.cat([img, img, img], dim=0)

Expand Down
6 changes: 0 additions & 6 deletions feat/detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,6 @@ def detect_faces(self, frame, threshold=0.5, **face_model_kwargs):
item is a list containing the (x1, y1, x2, y2) coordinates of each detected
face in that frame.
Examples:
>>> from feat import Detector
>>> from feat.utils import read_pictures
>>> img_data = read_pictures(['my_image.jpg'])
>>> detector = Detector()
>>> detector.detect_faces(frame)
"""

logging.info("detecting faces...")
Expand Down
Binary file added feat/tests/data/Image_with_alpha.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions feat/tests/test_detector_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ def test_detect_single_img_multi_face(default_detector, multi_face_img):
assert out.shape == (5, 173)


def test_detect_with_alpha(default_detector):
image = os.path.join(get_test_data_path(), "Image_with_alpha.png")
out = default_detector.detect_image(image)


# Multiple images
def test_detect_multi_img_single_face(default_detector, single_face_img):
"""Test detection of single face from multiple images"""
Expand Down
2 changes: 1 addition & 1 deletion feat/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.6.0"
__version__ = "0.6.1"
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ numpy>=1.9
seaborn>=0.7.0
matplotlib>=2.1
nltools>=0.4.7
scikit-learn>=1.0
numexpr<2.8.5
scikit-learn>=1.2
pywavelets>=0.3.0
h5py>=2.7.0
Pillow>=6.0.0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
],
test_suite="feat/tests",
**extra_setuptools_args
Expand Down

0 comments on commit f1073c1

Please sign in to comment.