Open Fqlox opened 3 years ago
Can you please try running os.environ["SM_FRAMEWORK"] = "tf.keras" before the first approach and let me know if it works?
The second issue seems related to https://github.com/justinshenk/fer/issues/13.
On Mon, Jul 5, 2021 at 6:49 PM Fqlox @.***> wrote:
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
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/justinshenk/fer/issues/26, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACOLMZA66B2UNKYSTRAIFC3TWHPADANCNFSM473BRO7Q .
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'
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 :
if I try :
detector = FER(mtcnn=False)
I get a :
Using miniconda 4.10 and this packages
Thanks in advance