boukhayma / face_normals

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem z uruchomieniem

twardy9303 opened this issue · comments

Nie mogę uruchomić pliku tester.py, podaje błąd:

Traceback (most recent call last):
File "C:\Users\tward\Documents\git\face_normals\tester.py", line 4, in
from resnet_unet import ResNetUNet
File "C:\Users\tward\Documents\git\face_normals\resnet_unet_init_.py", line 1, in
from .resnet_unet_model import ResNetUNet
File "C:\Users\tward\Documents\git\face_normals\resnet_unet\resnet_unet_model.py", line 3, in
from resnet import resnet18
File "C:\Python310\lib\site-packages\resnet_init_.py", line 1, in
from keras.applications.resnet50 import ResNet50
ModuleNotFoundError: No module named 'keras.applications.resnet50'

@twardy9303
try changin this
image

it was what worked for me

After adding this line of code, the program started, but I got another message:

C:\Python310\lib\site-packages\torchvision\models\_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and will be removed in 0.15, please use 'weights' instead. warnings.warn( C:\Python310\lib\site-packages\torchvision\models\_utils.py:223: UserWarning: Arguments other than a weight enum or Nonefor 'weights' are deprecated since 0.13 and will be removed in 0.15. The current behavior is equivalent to passingweights=ResNet18_Weights.IMAGENET1K_V1. You can also use weights=ResNet18_Weights.DEFAULT to get the most up-to-date weights. warnings.warn(msg)

are you using the jupiter notebook to see the result?
At the moment it was the only place I tested and I didnt have this error.

i only use terminal on windows 11.

Sorry I dont know what else you could do.

These are some of the changes I did in the path AppData\Local\Programs\Python\Python37\Lib\site-packages\resnet to make it work:

For importing ResNet50:
from tensorflow.keras.applications.resnet50 import ResNet50

Some other changes in resnet101.py and resnet152.py

from tensorflow.keras.layers import BatchNormalization
from tensorflow.keras.models import Model
from tensorflow.keras import initializers
from tensorflow.keras.layers import Layer, InputSpec
from tensorflow.keras.utils import get_source_inputs
from tensorflow.keras import backend as K
from keras_applications.imagenet_utils import _obtain_input_shape 
from tensorflow.keras.utils import get_file

There might be some minor differences, however whichever line gives you an error, Google it to see a valid way to import the module. All Keras imports probably need to be modified into tensorflow.keras imports.