Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import errors #13

Open
yuskey opened this issue Apr 18, 2019 · 6 comments
Open

Import errors #13

yuskey opened this issue Apr 18, 2019 · 6 comments

Comments

@yuskey
Copy link

yuskey commented Apr 18, 2019

Hey guys, I keep getting an issue importing the submodules like models, etc. I'm not sure if this is a python 3 issue or what? Essentially it does not find the models module when I am running example.py, any ideas?

@Anurag14
Copy link

Anurag14 commented May 8, 2019

I am also facing same issue Import error no module named models
$ tf-insightface> python apps/demo.py

Is the command that i gave to run demo

@Anurag14
Copy link

Anurag14 commented May 8, 2019

Insert following lines to the files in apps folder at the top

import sys
sys.path.insert(0, '.')

and in models/face_tracker_server.py

from models import base_server

Then try and run both python apps/demo.py and python apps/example.py

@xingyi-li
Copy link

Thanks for @Anurag14 's solution, but in order to run correctly:
in models/face_describer_server.py, instead of import base_server, use from models import base_server, no need to add from models import base_server in models/face_tracker_server.py

@dasmehdix
Copy link

dasmehdix commented Sep 16, 2019

@singngai @Anurag14 @yuskey @KleinYuan
I added that code to apps/demo.py and apps/example.py
import sys sys.path.insert(0, '.')

Still I get error about "no module named models".

please help me, I also changed models/face_describer_server.py.

@xingyi-li
Copy link

xingyi-li commented Sep 16, 2019

@dasmehdix Hi, I'm delighted to help you, but I'm not sure if I still remember how to correctly solve this issue because it has been a long time since I tackled this problem. Anyway, I can offer you the following suggestions, please feel free to contact me if you still aren't capable of solving this issue :-), check them out:

  1. In models/face_describer_server.py:
# import base_server
from models import base_server


class FDServer(base_server.BaseServer):

    def __init__(self, *args, **kwargs):
        super(FDServer, self).__init__(*args, **kwargs)
  1. In models/face_tracker_server.py:
import cv2
import face_recognition

'''
This server:
    Input: Camera frame
    Output: Relative locations for each face, with [(tr_x, tr_y, bl_x, bl_y)]

x1,y1 ------
|          |
|          |
|          |
--------x2,y2
'''
  1. In apps/demo.py:
import sys
sys.path.insert(0, '.')
import cv2
import numpy as np
from models import face_track_server, face_describer_server, face_db, camera_server
from configs import configs
  1. In apps/example.py:
import sys
sys.path.insert(0, '.')
import cv2
import numpy as np
from models import base_server
from configs import configs
  1. In apps/__init__.py:
import sys
sys.path.insert(0, '.')

@dasmehdix
Copy link

@singngai Thank you SO MUCH:) <3 <3 <3 <3 Worked :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants