Face_Recognition_using_Siamese_Network icon indicating copy to clipboard operation
Face_Recognition_using_Siamese_Network copied to clipboard

AttributeError: module 'tensorflow._api.v1.compat.v2' has no attribute '__internal__'

Open jeonga0303 opened this issue 1 year ago • 0 comments

If you get the same error, change the import declaration part as follows

file name: Encoder_Training_(Triplet_Loss).ipynb

Before

import os
import numpy as np
import matplotlib.pyplot as plt

from PIL import Image
from numpy import asarray
from mtcnn.mtcnn import MTCNN
from keras.models import Model,model_from_json,load_model
from keras.layers import Layer,Input
from keras.optimizers import Adam
from sklearn.model_selection import train_test_split
from keras.utils import plot_model
import keras.backend as K

after

import os
import numpy as np
import matplotlib.pyplot as plt

from PIL import Image
from numpy import asarray
from mtcnn.mtcnn import MTCNN
from tensorflow.keras.models import Model,model_from_json,load_model
from tensorflow.keras.layers import Layer,Input
from tensorflow.keras.optimizers import Adam
from sklearn.model_selection import train_test_split
from tensorflow.keras.utils import plot_model
import tensorflow.keras.backend as K

and my tensorflow version is 1.15.0.

I tested it through dockerfile, Please refer to dockerfile. (You have to open and use port 8877 in docker-compose.yml)

FROM tensorflow/tensorflow:1.15.0-py3
RUN pip install numpy matplotlib Pillow mtcnn opencv-python Keras
RUN pip install jupyter
ENTRYPOINT jupyter notebook --allow-root --ip='0.0.0.0' --port=8877 --no-browser

jeonga0303 avatar Jan 18 '24 05:01 jeonga0303