GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — deepfeatinterp/facemodel_server.py at master · paulu/deepfeatinterp

Expand file tree

/

facemodel_server.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
49 lines (41 loc) · 1.34 KB
/

facemodel_server.py

Copy path

File metadata and controls

49 lines (41 loc) · 1.34 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python2
from __future__ import division
from __future__ import with_statement
from __future__ import print_function
import os
import subprocess
import pickle
import time
'''
This is old code used by dataset_rebuild. The newer execnet code
(facemodel_worker) is probably more reliable.
'''
def facemodel_server_start():
if not os.path.exists('models/facemodel/model.t7'):
url='https://www.dropbox.com/s/18s63zomyfacjfs/facemodel.t7?dl=1'
subprocess.check_call(['wget',url,'-O','models/facemodel/model.t7'])
os.chdir('models/facemodel')
try:
p=subprocess.Popen(['python','-u','server.py'],stdin=subprocess.PIPE,stdout=subprocess.PIPE,close_fds=True)
finally:
os.chdir('../..')
return p
def facemodel_server_predict(p,ipath):
print(pickle.dumps('../../'+ipath).encode('string_escape'),file=p.stdin)
p.stdin.flush()
rawdata=p.stdout.readline()
scores=pickle.loads(rawdata.decode('string_escape'))
return scores
def facemodel_server_stop(p):
print(pickle.dumps(None).encode('string_escape'),file=p.stdin)
def facemodel_server_finally(p):
retcode=p.poll()
if retcode is None:
p.terminate()
time.sleep(0.001)
retcode=p.poll()
if retcode is None:
p.kill()
else:
if retcode!=0:
raise subprocess.CalledProcessError('facemodel server returned non-zero exit status {}'.format(retcode))
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.