Jacob-Mellichamp / DistractionDector

A Computer Vision solution using OpenCV and Tensorflow to determine if a user is paying attention at a workstation
4 stars 2 forks source link

Not found: NewRandomAccessFile failed to Create/Open: models/pose_model/variables\variables.data-00000-of-00001 : The system cannot find the file specified. #1

Open SuvanshTembe opened 6 months ago

SuvanshTembe commented 6 months ago

I'm trying to create a DIstraction Detector model for my college project using this model as a reference , I want to work on it. So, first of all , this code requirements is working with python 3.8 version. So after encountering many errors, im down to 1 single error:

Not found: NewRandomAccessFile failed to Create/Open: models/pose_model/variables\variables.data-00000-of-00001 : The system cannot find the file specified. This error is saying that it cannot locate the file "variables.data-00000-of-00001" in models/variables.
In another markerdetector file, saved_model='models/pose_model/'. I've tried changing the path of saved_model to saved_model.pb file. But none of it is use it says it needs a variables.data file which is missing . I've tried searching for solutions , but none of it is working . In the github code provided by Jake mellichamp, no variables.data file is there. SO idk what to do from here. This is my college project so i need this done before deadlines and our team has lots of hope for this project. Im attaching all the sc of the error and code.

markerdetector variables saved_model in markerdetector file error Screenshot 2024-04-23 175817

Jacob-Mellichamp commented 6 months ago

Will continue to look into this... it does seem like maybe something wasn't copied over. The original code is unavailble to be looked at this time -- if your group needs to get something up and running quick:

https://github.com/yinguobing/head-pose-estimation https://learnopencv.com/head-pose-estimation-using-opencv-and-dlib/

SuvanshTembe commented 6 months ago

I had the same idea. Thats why i cloned the same model you used after i found about it reading a article of yours . So i have the head pose model nice working and running. I just being inexperienced, don't seem to understand how to rebuild your software using that model. Should i just add markerdetector and main file and copy and paste from your project. Idk how to get this done. Need help

Jacob-Mellichamp commented 6 months ago

You need an AI model that can show the 'individual facial marks' on a face. which is what the markerdetector.py is sorta responsibile for.

Once the facial data has been gathered, we find the points we are interested in (for me it was the nose, eyes, and chin. and then perform some logic to get meaning from it.

So in your case:

  1. Find a way to get a facial-marker AI model to work
  2. Replace marker_detector.py with that new working facial marker AI model logic.
  3. The Main while-loop in main.py should just be plug & play once you have away to get the facial data.

THis code below is from main.py and showcases how we get the facial + nose markers necessary to then perform pose-estimation. So if you can get facial markers to work up into this point -- the algorithm should work after.

                faceboxes = mark_detector.extract_cnn_facebox(img)

                for facebox in faceboxes:
                    face_img = optimize_face(facebox, img)

                    marks = mark_detector.detect_marks([face_img])
                    marks *= (facebox[2] - facebox[0])
                    marks[:, 0] += facebox[0]
                    marks[:, 1] += facebox[1]
                    shape = marks.astype(np.uint)

                    #Draw Markers on face
                    #mark_detector.draw_marks(img, marks, color=(0, 255, 0))
                    image_points = np.array([
                                            shape[30],     # Nose tip
                                            shape[8],     # Chin
                                            shape[36],     # Left eye left corner
                                            shape[45],     # Right eye right corne
                                            shape[48],     # Left Mouth corner
                                            shape[54]      # Right mouth corner
                                        ], dtype="double")

                    nose_points = np.array([
                        shape[27],
                        shape[28], 
                        shape[29],
                        shape[30]
                    ])

Cheers! (I'm away from the computer I originally wrote this thing on).