ModuleNotFoundError: No module named 'Model' issues in Training Images

I am trying to do a program with the help of some resources. Suddenly, I got an import error.

import cv2
import numpy as np
from PIL import Image
import os
import numpy as np
import cv2
import os
import h5py
#import dlib
from imutils import face_utils
from keras.models import load_model
import sys
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D,Dropout
from keras.layers import Dense, Activation, Flatten
#from keras.utils import to_categorical
from tensorflow.keras.utils import to_categorical
from keras import backend as K 
from sklearn.model_selection import train_test_split
from Model import model
from model.Model import model
from keras import callbacks

When I run the above program, I got the following error about import Model

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-8cbfce6231b9> in <module>
     18 from keras import backend as K
     19 from sklearn.model_selection import train_test_split
---> 20 from Model import model
     21 from model.Model import model
     22 from keras import callbacks

ModuleNotFoundError: No module named 'Model'

I am trying to solve a lot of times but I failed to solve this issue.

Upvotes: 0

Views: 1273

Answers (1)

Eniola Oyekanmi
Eniola Oyekanmi

Reputation: 1

This was surprisingly easy. I fixed this by matching the case of the first letter of M to what the model file is saved as. For me, the file was saved as the model and I called it "Model". So I just fixed this by renaming the model file as "Model"

Upvotes: 0

Related Questions