Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
P
py-bigstream-cam
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kamron Aroonrua
py-bigstream-cam
Commits
eacc9a6f
Commit
eacc9a6f
authored
Oct 29, 2019
by
Kamron Aroonrua
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
faceprocess
parent
d7af6ddc
Pipeline
#50
canceled with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
faceprocess.py
test/faceprocess.py
+40
-0
No files found.
test/faceprocess.py
0 → 100644
View file @
eacc9a6f
import
face_recognition
import
os
import
re
def
image_files_in_folder
(
folder
):
return
[
os
.
path
.
join
(
folder
,
f
)
for
f
in
os
.
listdir
(
folder
)
if
re
.
match
(
r'.*\.(jpg|jpeg|png)'
,
f
,
flags
=
re
.
I
)]
def
load_face_db
(
known_people_folder
):
known_names
=
[]
known_face_encodings
=
[]
db
=
[]
rec
=
{}
for
file
in
image_files_in_folder
(
known_people_folder
):
basename
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
file
))[
0
]
img
=
face_recognition
.
load_image_file
(
file
)
#encodings = face_recognition.face_encodings(img)
encodings
=
face_recognition
.
face_locations
(
img
,
model
=
"cnn"
)
print
(
'loading facedb >> '
+
basename
)
if
len
(
encodings
)
>
1
:
click
.
echo
(
"WARNING: More than one face found in {}. Only considering the first face."
.
format
(
file
))
if
len
(
encodings
)
==
0
:
click
.
echo
(
"WARNING: No faces found in {}. Ignoring file."
.
format
(
file
))
else
:
#known_names.append(basename)
#known_face_encodings.append(encodings[0])
rec
=
{
'name'
:
basename
.
split
(
'_'
)[
0
],
'face_encoding'
:
encodings
[
0
]}
db
.
append
(
rec
)
return
db
######################################################################################
###################################### Main ##########################################
face_folder
=
'../facedb'
facedb
=
load_face_db
(
face_folder
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment