Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue depending on mtcnn or simple Cascade Classifier #26

Open
Fqlox opened this issue Jul 5, 2021 · 2 comments
Open

Issue depending on mtcnn or simple Cascade Classifier #26

Fqlox opened this issue Jul 5, 2021 · 2 comments

Comments

@Fqlox
Copy link

Fqlox commented Jul 5, 2021

Hi,

I tried to run the Justin.jpg simple example and got Issues with the detector:

if I try :

detector = FER(mtcnn=True)

I get a :

  File "[]/opt/miniconda3/envs/fer/lib/python3.6/site-packages/keras/initializers/__init__.py", line 49, in populate_deserializable_objects
    LOCAL.GENERATED_WITH_V2 = tf.__internal__.tf2.enabled()
AttributeError: module 'tensorflow.compat.v2.__internal__' has no attribute 'tf2'

if I try :

detector = FER(mtcnn=False)

I get a :

  File "[]/opt/miniconda3/envs/fer/lib/python3.6/site-packages/fer/fer.py", line 168, in find_faces
    if isinstance(self.__face_detector, cv2.CascadeClassifier):
TypeError: isinstance() arg 2 must be a type or tuple of types

Using miniconda 4.10
and this packages

Package                 Version
----------------------- -------------------
absl-py                 0.13.0
astor                   0.8.1
astunparse              1.6.3
bleach                  1.5.0
cached-property         1.5.2
cachetools              4.2.2
certifi                 2021.5.30
chardet                 4.0.0
cycler                  0.10.0
dataclasses             0.8
fer                     20.1.3
flatbuffers             1.12
gast                    0.3.3
google-auth             1.32.1
google-auth-oauthlib    0.4.4
google-pasta            0.2.0
grpcio                  1.32.0
h5py                    2.10.0
html5lib                0.9999999
idna                    2.10
importlib-metadata      4.6.1
Keras                   2.4.3
Keras-Applications      1.0.8
keras-nightly           2.5.0.dev2021032900
Keras-Preprocessing     1.1.2
kiwisolver              1.3.1
Markdown                3.3.4
matplotlib              3.3.4
mtcnn                   0.1.0
numpy                   1.19.5
oauthlib                3.1.1
opencv-contrib-python   3.3.0.9
opencv-python           4.5.2.54
opt-einsum              3.3.0
pandas                  1.1.5
Pillow                  8.3.0
pip                     21.1.3
protobuf                3.17.3
pyasn1                  0.4.8
pyasn1-modules          0.2.8
pyparsing               2.4.7
python-dateutil         2.8.1
pytz                    2021.1
PyYAML                  5.4.1
requests                2.25.1
requests-oauthlib       1.3.0
rsa                     4.7.2
scipy                   1.5.4
setuptools              52.0.0.post20210125
six                     1.15.0
tensorboard             2.5.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit  1.8.0
tensorflow              2.4.1
tensorflow-estimator    2.4.0
termcolor               1.1.0
typing-extensions       3.7.4.3
urllib3                 1.26.6
Werkzeug                2.0.1
wheel                   0.36.2
wrapt                   1.12.1
zipp                    3.5.0

Thanks in advance

@JustinShenk
Copy link
Owner

JustinShenk commented Jul 8, 2021 via email

@Fqlox
Copy link
Author

Fqlox commented Jul 8, 2021

Alright, I tried :


import cv2
from fer import FER
import os

os.environ["SM_FRAMEWORK"] = "tf.keras"

detector = FER(mtcnn=True) # or with mtcnn=False for Haar Cascade Classifier

image = cv2.imread("justin.png") ....

I got :

WARNING:tensorflow:From /Users/user/opt/miniconda3/envs/fer/lib/python3.6/site-packages/tensorflow/python/compat/v2_compat.py:96: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
Traceback (most recent call last):
  File "webcam.py", line 13, in <module>
    detector = FER(mtcnn=True) # or with mtcnn=False for Haar Cascade Classifier
  File "/Users/user/opt/miniconda3/envs/fer/lib/python3.6/site-packages/fer/fer.py", line 98, in __init__
    from mtcnn.mtcnn import MTCNN
  File "/Users/user/opt/miniconda3/envs/fer/lib/python3.6/site-packages/mtcnn/__init__.py", line 26, in <module>
    from mtcnn.mtcnn import MTCNN
  File "/Users/user/opt/miniconda3/envs/fer/lib/python3.6/site-packages/mtcnn/mtcnn.py", line 37, in <module>
    from mtcnn.network.factory import NetworkFactory
  File "/Users/user/opt/miniconda3/envs/fer/lib/python3.6/site-packages/mtcnn/network/factory.py", line 26, in <module>
    from keras.layers import Input, Dense, Conv2D, MaxPooling2D, PReLU, Flatten, Softmax
  File "/Users/user/opt/miniconda3/envs/fer/lib/python3.6/site-packages/keras/__init__.py", line 20, in <module>
    from . import initializers
  File "/Users/user/opt/miniconda3/envs/fer/lib/python3.6/site-packages/keras/initializers/__init__.py", line 124, in <module>
    populate_deserializable_objects()
  File "/Users/user/opt/miniconda3/envs/fer/lib/python3.6/site-packages/keras/initializers/__init__.py", line 49, in populate_deserializable_objects
    LOCAL.GENERATED_WITH_V2 = tf.__internal__.tf2.enabled()
AttributeError: module 'tensorflow.compat.v2.__internal__' has no attribute 'tf2'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants