├── .gitignore
├── LICENSE
├── README.md
├── 仿真程序
├── 串口助手
│ ├── UartAssist.cfg
│ └── UartAssist.exe
└── 仿真M0_smartHome.exe
├── 客户端
└── FaceRecognitionAttendanceSystem
│ ├── .vs
│ └── FaceRecognitionAttendanceSystem
│ │ └── v16
│ │ └── .suo
│ ├── FaceDateSet.py
│ ├── FaceImageDate
│ ├── others
│ │ ├── 1_100.jpg
│ │ ├── 1_101.jpg
│ │ ├── 1_102.jpg
│ │ ├── 1_103.jpg
│ │ ├── 1_60.jpg
│ │ ├── 1_61.jpg
│ │ ├── 1_62.jpg
│ │ ├── 1_63.jpg
│ │ ├── 1_64.jpg
│ │ ├── 1_65.jpg
│ │ ├── 1_66.jpg
│ │ ├── 1_67.jpg
│ │ ├── 1_68.jpg
│ │ ├── 1_69.jpg
│ │ ├── 1_70.jpg
│ │ ├── 1_71.jpg
│ │ ├── 1_72.jpg
│ │ ├── 1_73.jpg
│ │ ├── 1_74.jpg
│ │ ├── 1_75.jpg
│ │ ├── 1_76.jpg
│ │ ├── 1_77.jpg
│ │ ├── 1_78.jpg
│ │ ├── 1_79.jpg
│ │ ├── 1_80.jpg
│ │ ├── 1_81.jpg
│ │ ├── 1_82.jpg
│ │ ├── 1_83.jpg
│ │ ├── 1_84.jpg
│ │ ├── 1_85.jpg
│ │ ├── 1_86.jpg
│ │ ├── 1_87.jpg
│ │ ├── 1_88.jpg
│ │ ├── 1_89.jpg
│ │ ├── 1_90.jpg
│ │ ├── 1_91.jpg
│ │ ├── 1_92.jpg
│ │ ├── 1_93.jpg
│ │ ├── 1_94.jpg
│ │ ├── 1_95.jpg
│ │ ├── 1_96.jpg
│ │ ├── 1_97.jpg
│ │ ├── 1_98.jpg
│ │ └── 1_99.jpg
│ └── wengfeilong
│ │ ├── 1_1.jpg
│ │ ├── 1_10.jpg
│ │ ├── 1_11.jpg
│ │ ├── 1_12.jpg
│ │ ├── 1_13.jpg
│ │ ├── 1_14.jpg
│ │ ├── 1_15.jpg
│ │ ├── 1_16.jpg
│ │ ├── 1_17.jpg
│ │ ├── 1_18.jpg
│ │ ├── 1_19.jpg
│ │ ├── 1_2.jpg
│ │ ├── 1_20.jpg
│ │ ├── 1_21.jpg
│ │ ├── 1_22.jpg
│ │ ├── 1_23.jpg
│ │ ├── 1_24.jpg
│ │ ├── 1_25.jpg
│ │ ├── 1_26.jpg
│ │ ├── 1_27.jpg
│ │ ├── 1_28.jpg
│ │ ├── 1_29.jpg
│ │ ├── 1_3.jpg
│ │ ├── 1_30.jpg
│ │ ├── 1_4.jpg
│ │ ├── 1_5.jpg
│ │ ├── 1_6.jpg
│ │ ├── 1_7.jpg
│ │ ├── 1_8.jpg
│ │ └── 1_9.jpg
│ ├── FaceRecognition.py
│ ├── FaceRecognitionAttendanceSystem.py
│ ├── FaceRecognitionAttendanceSystem.pyproj
│ ├── FaceRecognitionAttendanceSystem.sln
│ ├── FaceRecognitionAttendanceSystem.ui
│ ├── ImageAcquisition.py
│ ├── Model
│ └── me.face.model.h5
│ ├── ModelTraining.py
│ ├── __pycache__
│ ├── FaceDateSet.cpython-37.pyc
│ ├── FaceRecognitionAttendanceSystem.cpython-37.pyc
│ ├── ImageAcquisition.cpython-37.pyc
│ └── ModelTraining.cpython-37.pyc
│ └── main.py
└── 服务端
├── a.out
└── server.c
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | pip-wheel-metadata/
24 | share/python-wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyInstaller
31 | # Usually these files are written by a python script from a template
32 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
33 | *.manifest
34 | *.spec
35 |
36 | # Installer logs
37 | pip-log.txt
38 | pip-delete-this-directory.txt
39 |
40 | # Unit test / coverage reports
41 | htmlcov/
42 | .tox/
43 | .nox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | *.py,cover
51 | .hypothesis/
52 | .pytest_cache/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | target/
76 |
77 | # Jupyter Notebook
78 | .ipynb_checkpoints
79 |
80 | # IPython
81 | profile_default/
82 | ipython_config.py
83 |
84 | # pyenv
85 | .python-version
86 |
87 | # pipenv
88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
91 | # install all needed dependencies.
92 | #Pipfile.lock
93 |
94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95 | __pypackages__/
96 |
97 | # Celery stuff
98 | celerybeat-schedule
99 | celerybeat.pid
100 |
101 | # SageMath parsed files
102 | *.sage.py
103 |
104 | # Environments
105 | .env
106 | .venv
107 | env/
108 | venv/
109 | ENV/
110 | env.bak/
111 | venv.bak/
112 |
113 | # Spyder project settings
114 | .spyderproject
115 | .spyproject
116 |
117 | # Rope project settings
118 | .ropeproject
119 |
120 | # mkdocs documentation
121 | /site
122 |
123 | # mypy
124 | .mypy_cache/
125 | .dmypy.json
126 | dmypy.json
127 |
128 | # Pyre type checker
129 | .pyre/
130 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FaceRecognitionAttendanceSystem
2 | 基于Python+opencv+keras+numpy+sklearn的人脸识别门禁系统
3 |
4 | 欢迎访问个人博客:https://www.ikunl.com
5 | 项目地址:https://www.ikunl.com/1.html
6 |
7 | FaceRecognitionAttendanceSystem
8 | Python+opencv+keras+numpy+sklearn的人脸识别门禁系统
9 | 本项目为实习期间做的一款基于opencv的人脸识别门禁系统,作者某双非二本院校,写于2020/7/23。
10 |
11 |
12 | 作者 翁飞龙
13 | QQ交流群 692695467(点击跳转)
14 | 博客地址 https://www.ikunl.com
15 |
16 | 使用环境
17 | windows/Linux,支持Python3.6以上版本和GCC的编辑器
18 |
19 | 开发环境:Microsoft Visio Studio 2019(Python3.6)
20 |
21 | 准备材料
22 |
23 | 1、python环境所需要的包:numpyen、sorflow、keras、opencv、scikit-learn
24 | 2、Ubuntu虚拟机
25 | 3、M0_smartHome仿真软件
26 | 4、串口助手
27 | 5、vspd虚拟端口配置工具
28 |
29 |
30 | 注:本文用到的所有工具和源码均在文章末提供下载
31 |
32 |
33 | 一、项目结构
34 |
35 | 1、客户端
36 |
37 |
38 |
39 |
40 | main.py:主界面启动文件(暂未完成)
41 | ImageAcquisition.py:图像采集模块
42 | FaceDateSet.py:图像数据处理模块
43 | ModelTraining.py:模型训练模块
44 | FaceRecognition.py:人脸识别模块
45 | FaceImageDate:文件夹存放采集得到的灰度图片
46 | Model:文件夹存放训练好的人脸模型
47 |
48 |
49 | 2、服务端
50 |
51 | server.c服务端源代码
52 | a.out可执行文件
53 |
54 |
55 | 二、运行效果
56 |
57 | 识别到自己门打开,关闭报警
58 |
59 |
60 |
61 |
62 | 识别到其他人,关闭门,开始报警
63 |
64 |
65 |
66 |
67 | 三、源代码(客户端)
68 | 1、图像采集
69 | ImageAcquisition.py
70 |
71 |
72 | # -*- coding: utf-8 -*-
73 | __author__ = '翁飞龙'
74 | import cv2
75 | import numpy as np
76 | import os
77 |
78 | def path():
79 | name=input('\n enter user name:')
80 | path="./FaceImageDate/" + str(name)
81 | path=path.strip()
82 | path=path.rstrip("\\")
83 | isExists=os.path.exists(path)
84 | if not isExists:
85 | os.makedirs(path)
86 | print ( '\n ' + path + ' 创建成功')
87 | else:
88 | print ( '\n ' + path+ ' 名称已存在')
89 |
90 | return path
91 | def CatchPICFromVideo(path,catch_num):
92 | faceCascade = cv2.CascadeClassifier(r'D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Lib\site-packages\cv2\data\haarcascade_frontalface_default.xml')
93 | eyeCascade = cv2.CascadeClassifier(r'D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Lib\site-packages\cv2\data\haarcascade_eye.xml')
94 |
95 | # 调用笔记本内置摄像头,所以参数为0,如果有其他的摄像头可以调整参数为1,2
96 | camera = cv2.VideoCapture(0, cv2.CAP_DSHOW)
97 | face_id = input('\n enter user id:')
98 | print('\n 采集数据前请摘下您的眼镜、口罩等遮蔽物,请保持光线良好 ... ')
99 | print('\n 正在采集人脸数据,请稍后 ...')
100 |
101 | count = 0
102 |
103 | while True:
104 |
105 | # 从摄像头读取图片
106 |
107 | sucess, img = camera.read()
108 |
109 | # 转为灰度图片
110 |
111 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
112 |
113 | # 人脸检测
114 | faces = faceCascade.detectMultiScale(
115 | gray,
116 | scaleFactor=1.1,
117 | minNeighbors=5,
118 | minSize=(64, 64)
119 | )
120 | # 在检测人脸的基础上检测眼睛
121 | result = []
122 | for (x, y, w, h) in faces:
123 | fac_gray = gray[y: (y+h), x: (x+w)]
124 | eyes = eyeCascade.detectMultiScale(fac_gray, 1.3, 2)
125 |
126 | # 眼睛坐标的换算,将相对位置换成绝对位置
127 | for (ex, ey, ew, eh) in eyes:
128 | result.append((x+ex, y+ey, ew, eh))
129 |
130 | for (x, y, w, h) in faces:
131 | cv2.rectangle(img, (x, y), (x+w, y+w), (255, 0, 0),2)
132 | for (ex, ey, ew, eh) in result:
133 | cv2.rectangle(img, (ex, ey), (ex+ew, ey+eh), (0, 255, 0), 2)
134 | # 显示捕捉了多少张人脸
135 | font = cv2.FONT_HERSHEY_SIMPLEX
136 | cv2.putText(img, f'count:{str(count)}', (x + 30, y + 30), font, 1, (255, 0, 255), 4)
137 |
138 | count += 1
139 |
140 | img_name = path + '/' + str(face_id) + '_' + str(count) + '.jpg'
141 | # 保存图像(路径不能包含中文)
142 | #cv2.imwrite(img_name, gray[y: y + h, x: x + w])
143 |
144 | #保存图像
145 | cv2.imencode('.jpg', gray[y: y + h, x: x + w])[1].tofile(img_name)
146 |
147 | cv2.imshow('image', img)
148 |
149 | # 保持画面的持续。1ms
150 |
151 | k = cv2.waitKey(1)
152 |
153 | if k == 27: # 通过esc键退出摄像
154 | break
155 | elif count >= catch_num:
156 | break;
157 |
158 | print("\n 人脸信息采集完成")
159 | # 关闭摄像头
160 | camera.release()
161 | cv2.destroyAllWindows()
162 |
163 | if __name__ == '__main__':
164 | path=path()
165 | CatchPICFromVideo(path,100)
166 | 全选代码复制
167 | 2、数据处理
168 | FaceDateSet.py
169 |
170 | # -*- coding: utf-8 -*-
171 | __author__ = '翁飞龙'
172 | import os
173 | import numpy as np
174 | import cv2
175 | # 定义图片尺寸
176 | IMAGE_SIZE = 64
177 |
178 |
179 | # 按照定义图像大小进行尺度调整
180 | def resize_image(image, height=IMAGE_SIZE, width=IMAGE_SIZE):
181 | top, bottom, left, right = 0, 0, 0, 0
182 | # 获取图像尺寸
183 | h, w, _ = image.shape
184 | # 找到图片最长的一边
185 | longest_edge = max(h, w)
186 | # 计算短边需要填充多少使其与长边等长
187 | if h < longest_edge:
188 | d = longest_edge - h
189 | top = d // 2
190 | bottom = d // 2
191 | elif w < longest_edge:
192 | d = longest_edge - w
193 | left = d // 2
194 | right = d // 2
195 | else:
196 | pass
197 |
198 | # 设置填充颜色
199 | BLACK = [0, 0, 0]
200 | # 对原始图片进行填充操作
201 | constant = cv2.copyMakeBorder(image, top, bottom, left, right, cv2.BORDER_CONSTANT, value=BLACK)
202 | # 调整图像大小并返回
203 | return cv2.resize(constant, (height, width))
204 |
205 | images, labels = list(), list()
206 | # 读取训练数据
207 | def read_path(path):
208 | for dir_item in os.listdir(path):
209 | # 合并成可识别的操作路径
210 | full_path = os.path.abspath(os.path.join(path, dir_item))
211 | # 如果是文件夹,则继续递归调用
212 | if os.path.isdir(full_path):
213 | read_path(full_path)
214 | else:
215 | if dir_item.endswith('.jpg'):
216 | # print(dir_item)
217 | image = cv2.imread(full_path)
218 | image = resize_image(image, IMAGE_SIZE, IMAGE_SIZE)
219 | images.append(image)
220 | labels.append(path)
221 | #print(labels)
222 | return images, labels
223 |
224 |
225 | # 从指定路径读取训练数据
226 | def load_dataset(path):
227 | images, labels = read_path(path)
228 | # 由于图片是基于矩阵计算的, 将其转为矩阵
229 | images = np.array(images)
230 | print(images.shape)
231 | labels = np.array([0 if label.endswith('wengfeilong') else 1 for label in labels])
232 | return images, labels
233 |
234 |
235 | if __name__ == '__main__':
236 | images, labels = load_dataset(os.getcwd()+'/FaceImageDate')
237 | print('\n 读取结束,数据处理完成......')
238 | 全选代码复制
239 |
240 | 3、模型训练
241 | ModelTraining.py
242 |
243 |
244 | # -*- coding: utf-8 -*-
245 | __author__ = '翁飞龙'
246 | import random
247 | import numpy as np
248 | from sklearn.model_selection import train_test_split
249 | from keras.preprocessing.image import ImageDataGenerator
250 | from keras.models import Sequential
251 | from keras.layers import Dense, Activation, Flatten, Dropout
252 | from keras.layers import Conv2D, MaxPool2D
253 | from keras.optimizers import SGD
254 | from keras.utils import np_utils
255 | from keras.models import load_model
256 | from keras import backend as K
257 | from FaceDateSet import load_dataset, resize_image, IMAGE_SIZE
258 | import warnings
259 | warnings.filterwarnings('ignore')
260 |
261 |
262 | class Dataset:
263 | def __init__(self, path_name):
264 | # 训练集
265 | self.train_images = None
266 | self.train_labels = None
267 | # 验证集
268 | # self.valid_images = None
269 | # self.valid_labels = None
270 | # 测试集
271 | self.test_images = None
272 | self.test_labels = None
273 | # 数据加载路径
274 | self.path_name = path_name
275 | # 当前库采用的维度顺序
276 | self.input_shape = None
277 |
278 | def load(self, img_rows=IMAGE_SIZE, img_cols=IMAGE_SIZE, img_channels=3, nb_classes=2):
279 | # 加载数据集至内存
280 | images, labels = load_dataset(self.path_name)
281 | train_images, test_images, train_labels, test_labels = train_test_split(images, labels, test_size=0.3,
282 | random_state=random.randint(0, 10))
283 | #if K.image_dim_ordering() == 'th':
284 | if K.image_data_format() == 'channels_first':
285 | train_images = train_images.reshape(train_images.shape[0], img_channels, img_rows, img_cols)
286 | test_images = test_images.reshape(test_images.shape[0], img_channels, img_rows, img_cols)
287 | self.input_shape = (img_channels, img_rows, img_cols)
288 | else:
289 | train_images = train_images.reshape(train_images.shape[0], img_rows, img_cols, img_channels)
290 | test_images = test_images.reshape(test_images.shape[0], img_rows, img_cols, img_channels)
291 | self.input_shape = (img_rows, img_cols, img_channels)
292 |
293 | # 输出训练集、测试集的数量
294 | print(train_images.shape[0], 'train samples')
295 | print(test_images.shape[0], 'test samples')
296 | # 我们的模型使用categorical_crossentropy作为损失函数,因此需要根据类别数量nb_classes将
297 | # 类别标签进行one-hot编码使其向量化,在这里我们的类别只有两种,经过转化后标签数据变为二维
298 | train_labels = np_utils.to_categorical(train_labels, nb_classes)
299 | test_labels = np_utils.to_categorical(test_labels, nb_classes)
300 | # 像素数据浮点化以便归一化
301 | train_images = train_images.astype('float32')
302 | test_images = test_images.astype('float32')
303 | # 将其归一化,图像的各像素值归一化到0~1区间
304 | train_images /= 255.0
305 | test_images /= 255.0
306 | self.train_images = train_images
307 | self.test_images = test_images
308 | self.train_labels = train_labels
309 | self.test_labels = test_labels
310 |
311 |
312 | # CNN网络模型类
313 | class Model:
314 | def __init__(self):
315 | self.model = None
316 |
317 | # 建立模型
318 | def build_model(self, dataset, nb_classes=2):
319 | # 构建一个空的网络模型,它是一个线性堆叠模型,各神经网络层会被顺序添加,专业名称为序贯模型或线性堆叠模型
320 | self.model = Sequential()
321 |
322 | # 以下代码将顺序添加CNN网络需要的各层,一个add就是一个网络层
323 | self.model.add(Conv2D(32, 3, 3, border_mode='same',
324 | input_shape=dataset.input_shape)) # 1 2维卷积层
325 | self.model.add(Activation('relu')) # 2 激活函数层
326 |
327 | self.model.add(Conv2D(32, 3, 3)) # 3 2维卷积层
328 | self.model.add(Activation('relu')) # 4 激活函数层
329 |
330 | self.model.add(MaxPool2D(pool_size=(2, 2))) # 5 池化层
331 | self.model.add(Dropout(0.25)) # 6 Dropout层
332 |
333 | self.model.add(Conv2D(64, 3, 3, border_mode='same')) # 7 2维卷积层
334 | self.model.add(Activation('relu')) # 8 激活函数层
335 |
336 | self.model.add(Conv2D(64, 3, 3)) # 9 2维卷积层
337 | self.model.add(Activation('relu')) # 10 激活函数层
338 |
339 | self.model.add(MaxPool2D(pool_size=(2, 2))) # 11 池化层
340 | self.model.add(Dropout(0.25)) # 12 Dropout层
341 |
342 | self.model.add(Flatten()) # 13 Flatten层
343 | self.model.add(Dense(512)) # 14 Dense层,又被称作全连接层
344 | self.model.add(Activation('relu')) # 15 激活函数层
345 | self.model.add(Dropout(0.5)) # 16 Dropout层
346 | self.model.add(Dense(nb_classes)) # 17 Dense层
347 | self.model.add(Activation('softmax')) # 18 分类层,输出最终结果
348 |
349 | # 输出模型概况
350 | self.model.summary()
351 |
352 | # 训练模型
353 | def train(self, dataset, batch_size=20, nb_epoch=100, data_augmentation=True):
354 | sgd = SGD(lr=0.01, decay=1e-6,
355 | momentum=0.9, nesterov=True) # 采用SGD+momentum的优化器进行训练,首先生成一个优化器对象
356 | self.model.compile(loss='categorical_crossentropy',
357 | optimizer=sgd,
358 | metrics=['accuracy']) # 完成实际的模型配置工作
359 |
360 | # 不使用数据提升,所谓的提升就是从我们提供的训练数据中利用旋转、翻转、加噪声等方法创造新的
361 | # 训练数据,有意识的提升训练数据规模,增加模型训练量
362 | if not data_augmentation:
363 | self.model.fit(dataset.train_images,
364 | dataset.train_labels,
365 | batch_size=batch_size,
366 | nb_epoch=nb_epoch,
367 | validation_data=(dataset.test_images, dataset.test_labels),
368 | shuffle=True)
369 | # 使用实时数据提升
370 | else:
371 | # 定义数据生成器用于数据提升,其返回一个生成器对象datagen,datagen每被调用一
372 | # 次其生成一组数据(顺序生成),节省内存,其实就是python的数据生成器
373 | datagen = ImageDataGenerator(
374 | featurewise_center=False, # 是否使输入数据去中心化(均值为0),
375 | samplewise_center=False, # 是否使输入数据的每个样本均值为0
376 | featurewise_std_normalization=False, # 是否数据标准化(输入数据除以数据集的标准差)
377 | samplewise_std_normalization=False, # 是否将每个样本数据除以自身的标准差
378 | zca_whitening=False, # 是否对输入数据施以ZCA白化
379 | rotation_range=20, # 数据提升时图片随机转动的角度(范围为0~180)
380 | width_shift_range=0.2, # 数据提升时图片水平偏移的幅度(单位为图片宽度的占比,0~1之间的浮点数)
381 | height_shift_range=0.2, # 同上,只不过这里是垂直
382 | horizontal_flip=True, # 是否进行随机水平翻转
383 | vertical_flip=False) # 是否进行随机垂直翻转
384 |
385 | # 计算整个训练样本集的数量以用于特征值归一化、ZCA白化等处理
386 | datagen.fit(dataset.train_images)
387 |
388 | # 利用生成器开始训练模型
389 | self.model.fit_generator(datagen.flow(dataset.train_images, dataset.train_labels,
390 | batch_size=batch_size),
391 | samples_per_epoch=dataset.train_images.shape[0],
392 | nb_epoch=nb_epoch,
393 | validation_data=(dataset.test_images, dataset.test_labels))
394 |
395 | MODEL_PATH = './Model/face.model.h5'
396 |
397 | def save_model(self, file_path=MODEL_PATH):
398 | self.model.save(file_path)
399 |
400 | def load_model(self, file_path=MODEL_PATH):
401 | self.model = load_model(file_path)
402 |
403 | def evaluate(self, dataset):
404 | score = self.model.evaluate(dataset.test_images, dataset.test_labels, verbose=1)
405 | # print("%s: %.2f%%" % (self.model.metrics_names[1], score[1] * 100))
406 | print(f'{self.model.metrics_names[1]}:{score[1] * 100}%')
407 |
408 | # 识别人脸
409 | def face_predict(self, image):
410 | # 依然是根据后端系统确定维度顺序
411 | #if K.image_dim_ordering() == 'th'
412 | if K.image_data_format() == 'channels_first'and image.shape != (1, 3, IMAGE_SIZE, IMAGE_SIZE):
413 | image = resize_image(image) # 尺寸必须与训练集一致都应该是IMAGE_SIZE x IMAGE_SIZE
414 | image = image.reshape((1, 3, IMAGE_SIZE, IMAGE_SIZE)) # 与模型训练不同,这次只是针对1张图片进行预测
415 | #elif K.image_dim_ordering() == 'tf'
416 | elif K.image_data_format() == 'channels_last'and image.shape != (1, IMAGE_SIZE, IMAGE_SIZE, 3):
417 | image = resize_image(image)
418 | image = image.reshape((1, IMAGE_SIZE, IMAGE_SIZE, 3))
419 |
420 | # 浮点并归一化
421 | image = image.astype('float32')
422 | image /= 255.0
423 |
424 | # 给出输入属于各个类别的概率,我们是二值类别,则该函数会给出输入图像属于0和1的概率各为多少
425 | result = self.model.predict_proba(image)
426 | print('result:', result)
427 |
428 | # 给出类别预测:0或者1
429 | result = self.model.predict_classes(image)
430 |
431 | # 返回类别预测结果
432 | return result[0]
433 |
434 |
435 | if __name__ == '__main__':
436 | dataset = Dataset('./FaceImageDate/')
437 | dataset.load()
438 |
439 | # 训练模型
440 | model = Model()
441 | model.build_model(dataset)
442 | # 测试训练函数的代码
443 | model.train(dataset)
444 | model.save_model(file_path='./Model/me.face.model.h5')
445 | # 评估模型
446 | model = Model()
447 | model.load_model(file_path='./Model/me.face.model.h5')
448 | model.evaluate(dataset)
449 | 全选代码复制
450 |
451 | 4、人脸识别
452 | FaceRecognition.py
453 |
454 |
455 | # -*- coding: utf-8 -*-
456 | __author__ = '翁飞龙'
457 | import cv2
458 | from ModelTraining import Model
459 | import socket
460 |
461 | if __name__ == '__main__':
462 | # 加载模型
463 | model = Model()
464 | model.load_model(file_path='./Model/me.face.model.h5')
465 |
466 | # 框住人脸的矩形边框颜色
467 | color = (0, 255, 0)
468 |
469 | # 捕获指定摄像头的实时视频流
470 | camera = cv2.VideoCapture(0, cv2.CAP_DSHOW)
471 |
472 | # 人脸识别分类器本地存储路径
473 | cascade_path = "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Lib\site-packages\cv2\data\haarcascade_frontalface_default.xml"
474 |
475 | # 循环检测识别人脸
476 | while True:
477 | ret, img = camera.read() # 读取一帧视频
478 |
479 | # 图像灰化,降低计算复杂度
480 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
481 |
482 | # 使用人脸识别分类器,读入分类器
483 | cascade = cv2.CascadeClassifier(cascade_path)
484 |
485 | # 利用分类器识别出哪个区域为人脸
486 | fac_gray = cascade.detectMultiScale(gray, 1.1, 5)
487 | if len(fac_gray) > 0:
488 | for (x, y, w, h) in fac_gray:
489 | # 截取脸部图像提交给模型识别这是谁
490 | image = img[y: y + h, x: x + w]
491 | faceID = model.face_predict(image)
492 | print(faceID)
493 |
494 | # 如果是“我”
495 | if faceID == 0:
496 | cv2.rectangle(img, (x, y), (x + w, y + h), color, thickness=2)
497 |
498 | # 文字提示是谁
499 | cv2.putText(img, 'wengfeilong',
500 | (x + 30, y + 30), # 坐标
501 | cv2.FONT_HERSHEY_SIMPLEX, # 字体
502 | 1, # 字号
503 | (255, 0, 255), # 颜色
504 | 2) # 字的线宽
505 | client = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
506 | client.connect(('192.168.174.128',6666))
507 | print('\n Client is running')
508 | client.send(str(faceID).encode('utf-8'))
509 | #data = client.recv(1024).decode('utf-8')
510 | #client.send("yes".encode("utf-8")) #响应服务器端发送请求,为防止粘包的产生
511 | #print(data)
512 |
513 | else:
514 | cv2.rectangle(img, (x, y), (x + w, y + h), color, thickness=2)
515 |
516 | # 文字提示是谁
517 | cv2.putText(img, 'others',
518 | (x + 30, y + 30), # 坐标
519 | cv2.FONT_HERSHEY_SIMPLEX, # 字体
520 | 1, # 字号
521 | (255, 0, 255), # 颜色
522 | 2)
523 | client = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
524 | client.connect(('192.168.174.128',6666))
525 | print('\nClient is running...')
526 | client.send(str(faceID).encode('utf-8'))
527 | #data = client.recv(1024).decode('utf-8')
528 | #client.send("no".encode("utf-8")) #响应服务器端发送请求,为防止粘包的产生
529 | #print(data)
530 |
531 | cv2.imshow("camera", img)
532 |
533 | # 等待200毫秒看是否有按键输入
534 | k = cv2.waitKey(200)
535 | #如果输入q则退出循环
536 | if k & 0xFF == ord('q'):
537 | break
538 |
539 | # 释放摄像头并销毁所有窗口
540 | camera.release()
541 | cv2.destroyAllWindows()
542 | 全选代码复制
543 |
544 | 四、服务端
545 | server.c
546 |
547 |
548 | #include
549 | #include
550 | #include
551 | #include
552 | #include
553 | #include
554 | #include
555 | #include
556 | #include
557 | #include
558 | #include
559 | #include
560 |
561 | #define BAUDRATE B115200 ///Baud rate : 115200
562 | #define DEVICE "/dev/ttyS1"//设置端口号
563 | #define FALSE 0
564 | #define TRUE 1
565 | #define _POSIX_SOURCE 1 //POSIX系统兼容
566 | int SerialPort_Send(int i){
567 |
568 | int fd,res;
569 | struct termios oldtio,newtio;
570 |
571 | fd=open(DEVICE,O_RDWR | O_NOCTTY);
572 | if(fd<0){
573 | perror(DEVICE);
574 | exit(-1);
575 | }
576 | tcgetattr(fd,&oldtio);//保存原来的参数
577 | bzero(&newtio,sizeof(newtio));
578 | newtio.c_cflag=BAUDRATE | CS8 | CLOCAL | CREAD | HUPCL;
579 | newtio.c_iflag=IGNBRK;
580 | newtio.c_oflag=0;
581 | newtio.c_lflag=ICANON;
582 | tcflush(fd,TCIFLUSH);
583 | tcsetattr(fd,TCSANOW,&newtio);//设置串口参数
584 | printf("%d\n",i);
585 | if(i==0){
586 | char openbuf[255]={0xdd,0x05,0x24,0x00,0x09};
587 | char closebj[255]={0xdd,0x05,0x24,0x00,0x03};
588 | write(fd,openbuf,5);
589 | write(fd,closebj,5);
590 | close(fd);
591 | }
592 | else{
593 | char closebuf[255]={0xdd,0x05,0x24,0x00,0x0a};
594 | char baojing[255]={0xdd,0x05,0x24,0x00,0x02};
595 | write(fd,closebuf,5);
596 | write(fd,baojing,5);
597 | close(fd);
598 | }
599 |
600 | }
601 |
602 | int main()
603 | {
604 | int sockfd, new_fd;
605 | struct sockaddr_in my_addr;
606 | struct sockaddr_in their_addr;
607 | int sin_size;
608 | //建立TCP套接口
609 | if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
610 | {
611 | printf("create socket error");
612 | perror("socket");
613 | exit(1);
614 | }
615 | //初始化结构体,并绑定6666端口
616 | my_addr.sin_family = AF_INET;
617 | my_addr.sin_port = htons(6666);
618 | my_addr.sin_addr.s_addr = INADDR_ANY;
619 | bzero(&(my_addr.sin_zero), 8);
620 | int on;
621 | on = 1;
622 | setsockopt( sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on) );
623 | //绑定套接口
624 | if (bind(sockfd, (struct sockaddr*)&my_addr, sizeof(struct sockaddr)) == -1)
625 | {
626 | perror("bind socket error");
627 | exit(1);
628 | }
629 | //创建监听套接口
630 | if (listen(sockfd, 10) == -1)
631 | {
632 | perror("listen");
633 | exit(1);
634 | }
635 | //等待连接
636 | while (1)
637 | {
638 | sin_size = sizeof(struct sockaddr_in);
639 | printf("server is run......\n");
640 | //如果建立连接,将产生一个全新的套接字
641 | if ((new_fd = accept(sockfd, (struct sockaddr*)&their_addr, &sin_size)) == -1)
642 | {
643 | perror("accept");
644 | exit(1);
645 | }
646 | printf("accept success.\n");
647 | //break;
648 |
649 | //生成一个子进程来完成和客户端的会话,父进程继续监听
650 | if (!fork())
651 | {
652 | printf("create new thred success.\n");
653 | //读取客户端发来的信息
654 | int numbytes;
655 | char buff[1024];
656 | memset(buff, 0, 1024);
657 | if ((numbytes = recv(new_fd, buff, sizeof(buff), 0)) == -1)
658 | {
659 | perror("recv");
660 | exit(1);
661 | }
662 | printf("%s\n", buff);
663 | printf("--------------------------------------------------------\n\n");
664 | int i=(strcmp(buff,"0"));
665 | SerialPort_Send(i);
666 | /*if(i==0)
667 | {
668 | char success[]="success";
669 | if (send(new_fd, success, strlen(success), 0) == -1)
670 | perror("send");
671 | }
672 | else{
673 | char failed[]="failed";
674 | if (send(new_fd, failed, strlen(failed), 0) == -1)
675 | perror("send");
676 | }
677 |
678 | close(new_fd);
679 | exit(0);
680 | }*/
681 | close(new_fd);
682 | }
683 | }
684 | close(sockfd);
685 | }
686 |
--------------------------------------------------------------------------------
/仿真程序/串口助手/UartAssist.cfg:
--------------------------------------------------------------------------------
1 | [SHORTCUT]
2 | ledon=1|0|0|DD 09 24 00 00
3 |
4 |
--------------------------------------------------------------------------------
/仿真程序/串口助手/UartAssist.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/仿真程序/串口助手/UartAssist.exe
--------------------------------------------------------------------------------
/仿真程序/仿真M0_smartHome.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/仿真程序/仿真M0_smartHome.exe
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/.vs/FaceRecognitionAttendanceSystem/v16/.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/.vs/FaceRecognitionAttendanceSystem/v16/.suo
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceDateSet.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | __author__ = '翁飞龙'
3 | import os
4 | import numpy as np
5 | import cv2
6 | # 定义图片尺寸
7 | IMAGE_SIZE = 64
8 |
9 |
10 | # 按照定义图像大小进行尺度调整
11 | def resize_image(image, height=IMAGE_SIZE, width=IMAGE_SIZE):
12 | top, bottom, left, right = 0, 0, 0, 0
13 | # 获取图像尺寸
14 | h, w, _ = image.shape
15 | # 找到图片最长的一边
16 | longest_edge = max(h, w)
17 | # 计算短边需要填充多少使其与长边等长
18 | if h < longest_edge:
19 | d = longest_edge - h
20 | top = d // 2
21 | bottom = d // 2
22 | elif w < longest_edge:
23 | d = longest_edge - w
24 | left = d // 2
25 | right = d // 2
26 | else:
27 | pass
28 |
29 | # 设置填充颜色
30 | BLACK = [0, 0, 0]
31 | # 对原始图片进行填充操作
32 | constant = cv2.copyMakeBorder(image, top, bottom, left, right, cv2.BORDER_CONSTANT, value=BLACK)
33 | # 调整图像大小并返回
34 | return cv2.resize(constant, (height, width))
35 |
36 | images, labels = list(), list()
37 | # 读取训练数据
38 | def read_path(path):
39 | for dir_item in os.listdir(path):
40 | # 合并成可识别的操作路径
41 | full_path = os.path.abspath(os.path.join(path, dir_item))
42 | # 如果是文件夹,则继续递归调用
43 | if os.path.isdir(full_path):
44 | read_path(full_path)
45 | else:
46 | if dir_item.endswith('.jpg'):
47 | # print(dir_item)
48 | image = cv2.imread(full_path)
49 | image = resize_image(image, IMAGE_SIZE, IMAGE_SIZE)
50 | images.append(image)
51 | labels.append(path)
52 | #print(labels)
53 | return images, labels
54 |
55 |
56 | # 从指定路径读取训练数据
57 | def load_dataset(path):
58 | images, labels = read_path(path)
59 | # 由于图片是基于矩阵计算的, 将其转为矩阵
60 | images = np.array(images)
61 | print(images.shape)
62 | labels = np.array([0 if label.endswith('wengfeilong') else 1 for label in labels])
63 | return images, labels
64 |
65 |
66 | if __name__ == '__main__':
67 | images, labels = load_dataset(os.getcwd()+'/FaceImageDate')
68 | print('\n 读取结束,数据处理完成......')
69 |
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_100.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_100.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_101.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_101.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_102.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_102.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_103.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_103.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_60.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_60.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_61.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_61.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_62.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_62.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_63.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_63.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_64.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_64.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_65.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_65.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_66.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_66.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_67.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_67.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_68.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_68.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_69.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_69.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_70.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_70.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_71.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_71.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_72.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_72.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_73.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_73.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_74.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_74.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_75.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_75.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_76.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_76.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_77.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_77.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_78.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_78.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_79.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_79.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_80.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_80.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_81.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_81.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_82.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_82.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_83.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_83.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_84.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_84.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_85.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_85.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_86.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_86.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_87.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_87.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_88.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_88.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_89.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_89.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_90.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_90.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_91.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_91.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_92.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_92.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_93.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_93.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_94.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_94.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_95.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_95.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_96.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_96.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_97.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_97.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_98.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_98.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_99.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/others/1_99.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_1.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_10.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_11.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_12.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_12.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_13.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_13.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_14.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_14.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_15.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_15.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_16.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_16.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_17.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_17.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_18.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_18.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_19.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_19.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_2.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_20.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_20.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_21.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_21.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_22.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_22.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_23.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_23.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_24.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_24.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_25.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_25.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_26.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_26.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_27.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_27.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_28.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_28.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_29.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_29.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_3.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_30.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_30.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_4.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_5.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_6.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_7.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_8.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/FaceImageDate/wengfeilong/1_9.jpg
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceRecognition.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | __author__ = '翁飞龙'
3 | import cv2
4 | from ModelTraining import Model
5 | import socket
6 |
7 | if __name__ == '__main__':
8 | # 加载模型
9 | model = Model()
10 | model.load_model(file_path='./Model/me.face.model.h5')
11 |
12 | # 框住人脸的矩形边框颜色
13 | color = (0, 255, 0)
14 |
15 | # 捕获指定摄像头的实时视频流
16 | camera = cv2.VideoCapture(0, cv2.CAP_DSHOW)
17 |
18 | # 人脸识别分类器本地存储路径
19 | cascade_path = "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Lib\site-packages\cv2\data\haarcascade_frontalface_default.xml"
20 |
21 | # 循环检测识别人脸
22 | while True:
23 | ret, img = camera.read() # 读取一帧视频
24 |
25 | # 图像灰化,降低计算复杂度
26 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
27 |
28 | # 使用人脸识别分类器,读入分类器
29 | cascade = cv2.CascadeClassifier(cascade_path)
30 |
31 | # 利用分类器识别出哪个区域为人脸
32 | fac_gray = cascade.detectMultiScale(gray, 1.1, 5)
33 | if len(fac_gray) > 0:
34 | for (x, y, w, h) in fac_gray:
35 | # 截取脸部图像提交给模型识别这是谁
36 | image = img[y: y + h, x: x + w]
37 | faceID = model.face_predict(image)
38 | print(faceID)
39 |
40 | # 如果是“我”
41 | if faceID == 0:
42 | cv2.rectangle(img, (x, y), (x + w, y + h), color, thickness=2)
43 |
44 | # 文字提示是谁
45 | cv2.putText(img, 'wengfeilong',
46 | (x + 30, y + 30), # 坐标
47 | cv2.FONT_HERSHEY_SIMPLEX, # 字体
48 | 1, # 字号
49 | (255, 0, 255), # 颜色
50 | 2) # 字的线宽
51 | client = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
52 | client.connect(('192.168.174.128',6666))
53 | print('\n Client is running')
54 | client.send(str(faceID).encode('utf-8'))
55 | #data = client.recv(1024).decode('utf-8')
56 | #client.send("yes".encode("utf-8")) #响应服务器端发送请求,为防止粘包的产生
57 | #print(data)
58 |
59 | else:
60 | cv2.rectangle(img, (x, y), (x + w, y + h), color, thickness=2)
61 |
62 | # 文字提示是谁
63 | cv2.putText(img, 'others',
64 | (x + 30, y + 30), # 坐标
65 | cv2.FONT_HERSHEY_SIMPLEX, # 字体
66 | 1, # 字号
67 | (255, 0, 255), # 颜色
68 | 2)
69 | client = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
70 | client.connect(('192.168.174.128',6666))
71 | print('\nClient is running...')
72 | client.send(str(faceID).encode('utf-8'))
73 | #data = client.recv(1024).decode('utf-8')
74 | #client.send("no".encode("utf-8")) #响应服务器端发送请求,为防止粘包的产生
75 | #print(data)
76 |
77 | cv2.imshow("camera", img)
78 |
79 | # 等待200毫秒看是否有按键输入
80 | k = cv2.waitKey(200)
81 | #如果输入q则退出循环
82 | if k & 0xFF == ord('q'):
83 | break
84 |
85 | # 释放摄像头并销毁所有窗口
86 | camera.release()
87 | cv2.destroyAllWindows()
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceRecognitionAttendanceSystem.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'FaceRecognitionAttendanceSystem.ui'
4 | #
5 | # Created by: PyQt5 UI code generator 5.15.0
6 | #
7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is
8 | # run again. Do not edit this file unless you know what you are doing.
9 |
10 |
11 | from PyQt5 import QtCore, QtGui, QtWidgets
12 |
13 |
14 | class Ui_Form(object):
15 | def setupUi(self, Form):
16 | Form.setObjectName("Form")
17 | Form.resize(1144, 845)
18 | self.centralwidget = QtWidgets.QWidget(Form)
19 | self.centralwidget.setObjectName("centralwidget")
20 | self.face = QtWidgets.QLabel(self.centralwidget)
21 | self.face.setGeometry(QtCore.QRect(400, 30, 511, 321))
22 | self.face.setStyleSheet("\n"
23 | "background-color: rgb(6, 6, 6);")
24 | self.face.setText("")
25 | self.face.setObjectName("face")
26 | self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget)
27 | self.verticalLayoutWidget.setGeometry(QtCore.QRect(950, 20, 160, 331))
28 | self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
29 | self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
30 | self.verticalLayout.setContentsMargins(0, 0, 0, 0)
31 | self.verticalLayout.setObjectName("verticalLayout")
32 | self.ImageAcquisition = QtWidgets.QPushButton(self.verticalLayoutWidget)
33 | self.ImageAcquisition.setObjectName("ImageAcquisition")
34 | self.verticalLayout.addWidget(self.ImageAcquisition)
35 | self.FaceDateSet = QtWidgets.QPushButton(self.verticalLayoutWidget)
36 | self.FaceDateSet.setObjectName("FaceDateSet")
37 | self.verticalLayout.addWidget(self.FaceDateSet)
38 | self.ModelTraining = QtWidgets.QPushButton(self.verticalLayoutWidget)
39 | self.ModelTraining.setObjectName("ModelTraining")
40 | self.verticalLayout.addWidget(self.ModelTraining)
41 | self.FaceRecognition = QtWidgets.QPushButton(self.verticalLayoutWidget)
42 | self.FaceRecognition.setObjectName("FaceRecognition")
43 | self.verticalLayout.addWidget(self.FaceRecognition)
44 | self.client = QtWidgets.QListWidget(self.centralwidget)
45 | self.client.setGeometry(QtCore.QRect(400, 380, 341, 411))
46 | self.client.setObjectName("client")
47 | item = QtWidgets.QListWidgetItem()
48 | font = QtGui.QFont()
49 | font.setPointSize(10)
50 | item.setFont(font)
51 | self.client.addItem(item)
52 | self.information = QtWidgets.QTextEdit(self.centralwidget)
53 | self.information.setGeometry(QtCore.QRect(30, 50, 311, 741))
54 | font = QtGui.QFont()
55 | font.setPointSize(13)
56 | self.information.setFont(font)
57 | self.information.setObjectName("information")
58 | self.server = QtWidgets.QListWidget(self.centralwidget)
59 | self.server.setGeometry(QtCore.QRect(810, 380, 311, 411))
60 | self.server.setObjectName("server")
61 | item = QtWidgets.QListWidgetItem()
62 | font = QtGui.QFont()
63 | font.setPointSize(10)
64 | item.setFont(font)
65 | self.server.addItem(item)
66 | Form.setCentralWidget(self.centralwidget)
67 | self.statusbar = QtWidgets.QStatusBar(Form)
68 | self.statusbar.setObjectName("statusbar")
69 | Form.setStatusBar(self.statusbar)
70 |
71 | self.retranslateUi(Form)
72 | QtCore.QMetaObject.connectSlotsByName(Form)
73 |
74 | def retranslateUi(self, Form):
75 | _translate = QtCore.QCoreApplication.translate
76 | Form.setWindowTitle(_translate("Form", "MainWindow"))
77 | self.ImageAcquisition.setText(_translate("Form", "成员录入"))
78 | self.FaceDateSet.setText(_translate("Form", "数据处理"))
79 | self.ModelTraining.setText(_translate("Form", "模型训练"))
80 | self.FaceRecognition.setText(_translate("Form", "人脸识别"))
81 | __sortingEnabled = self.client.isSortingEnabled()
82 | self.client.setSortingEnabled(False)
83 | item = self.client.item(0)
84 | item.setText(_translate("Form", "客户端:"))
85 | self.client.setSortingEnabled(__sortingEnabled)
86 | self.information.setHtml(_translate("Form", "\n"
87 | "\n"
90 | "项目名称:人脸识别门禁系统
\n"
91 | "采用技术:python+OpenCV+pyQT5
\n"
92 | "项目组长:翁飞龙
\n"
93 | "项目组员: 1
\n"
94 | " 2
\n"
95 | " 3
\n"
96 | " 4
\n"
97 | "
"))
98 | __sortingEnabled = self.server.isSortingEnabled()
99 | self.server.setSortingEnabled(False)
100 | item = self.server.item(0)
101 | item.setText(_translate("Form", "服务端:"))
102 | self.server.setSortingEnabled(__sortingEnabled)
103 |
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceRecognitionAttendanceSystem.pyproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | Debug
4 | 2.0
5 | d29aafc1-bf09-42b8-9d81-9a0fade1736c
6 | .
7 | FaceRecognition.py
8 |
9 |
10 | .
11 | .
12 | FaceRecognitionAttendanceSystem
13 | FaceRecognitionAttendanceSystem
14 | Global|PythonCore|3.7
15 |
16 |
17 | true
18 | false
19 |
20 |
21 | true
22 | false
23 |
24 |
25 |
26 | Code
27 |
28 |
29 | Code
30 |
31 |
32 |
33 | Code
34 |
35 |
36 | Code
37 |
38 |
39 | Code
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
160 |
161 |
162 |
163 |
164 |
165 |
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceRecognitionAttendanceSystem.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30309.148
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "FaceRecognitionAttendanceSystem", "FaceRecognitionAttendanceSystem.pyproj", "{D29AAFC1-BF09-42B8-9D81-9A0FADE1736C}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {D29AAFC1-BF09-42B8-9D81-9A0FADE1736C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {D29AAFC1-BF09-42B8-9D81-9A0FADE1736C}.Release|Any CPU.ActiveCfg = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | GlobalSection(ExtensibilityGlobals) = postSolution
21 | SolutionGuid = {1BB3F36A-D741-4A53-A3C9-DB58DF1DC4A1}
22 | EndGlobalSection
23 | EndGlobal
24 |
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/FaceRecognitionAttendanceSystem.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Form
4 |
5 |
6 |
7 | 0
8 | 0
9 | 1144
10 | 845
11 |
12 |
13 |
14 | MainWindow
15 |
16 |
17 |
18 |
19 |
20 | 400
21 | 30
22 | 511
23 | 321
24 |
25 |
26 |
27 |
28 | background-color: rgb(6, 6, 6);
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | 950
38 | 20
39 | 160
40 | 331
41 |
42 |
43 |
44 | -
45 |
46 |
47 | 成员录入
48 |
49 |
50 |
51 | -
52 |
53 |
54 | 数据处理
55 |
56 |
57 |
58 | -
59 |
60 |
61 | 模型训练
62 |
63 |
64 |
65 | -
66 |
67 |
68 | 人脸识别
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | 400
78 | 380
79 | 341
80 | 411
81 |
82 |
83 | -
84 |
85 | 客户端:
86 |
87 |
88 |
89 | 10
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 | 30
98 | 50
99 | 311
100 | 741
101 |
102 |
103 |
104 |
105 | 13
106 |
107 |
108 |
109 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
110 | <html><head><meta name="qrichtext" content="1" /><style type="text/css">
111 | p, li { white-space: pre-wrap; }
112 | </style></head><body style=" font-family:'SimSun'; font-size:13pt; font-weight:400; font-style:normal;">
113 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt;">项目名称:人脸识别门禁系统</span></p>
114 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt;">采用技术:python+OpenCV+pyQT5</span></p>
115 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt;">项目组长:翁飞龙</span></p>
116 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt;">项目组员: 1</span></p>
117 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt;"> 2</span></p>
118 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt;"> 3</span></p>
119 | <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt;"> 4</span></p>
120 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt;"><br /></p></body></html>
121 |
122 |
123 |
124 |
125 |
126 | 810
127 | 380
128 | 311
129 | 411
130 |
131 |
132 | -
133 |
134 | 服务端:
135 |
136 |
137 |
138 | 10
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/ImageAcquisition.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | __author__ = '翁飞龙'
3 | import cv2
4 | import numpy as np
5 | import os
6 |
7 | def path():
8 | name=input('\n enter user name:')
9 | path="./FaceImageDate/" + str(name)
10 | path=path.strip()
11 | path=path.rstrip("\\")
12 | isExists=os.path.exists(path)
13 | if not isExists:
14 | os.makedirs(path)
15 | print ( '\n ' + path + ' 创建成功')
16 | else:
17 | print ( '\n ' + path+ ' 名称已存在')
18 |
19 | return path
20 | def CatchPICFromVideo(path,catch_num):
21 | faceCascade = cv2.CascadeClassifier(r'D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Lib\site-packages\cv2\data\haarcascade_frontalface_default.xml')
22 | eyeCascade = cv2.CascadeClassifier(r'D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Lib\site-packages\cv2\data\haarcascade_eye.xml')
23 |
24 | # 调用笔记本内置摄像头,所以参数为0,如果有其他的摄像头可以调整参数为1,2
25 | camera = cv2.VideoCapture(0, cv2.CAP_DSHOW)
26 | face_id = input('\n enter user id:')
27 | print('\n 采集数据前请摘下您的眼镜、口罩等遮蔽物,请保持光线良好 ... ')
28 | print('\n 正在采集人脸数据,请稍后 ...')
29 |
30 | count = 0
31 |
32 | while True:
33 |
34 | # 从摄像头读取图片
35 |
36 | sucess, img = camera.read()
37 |
38 | # 转为灰度图片
39 |
40 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
41 |
42 | # 人脸检测
43 | faces = faceCascade.detectMultiScale(
44 | gray,
45 | scaleFactor=1.1,
46 | minNeighbors=5,
47 | minSize=(64, 64)
48 | )
49 | # 在检测人脸的基础上检测眼睛
50 | result = []
51 | for (x, y, w, h) in faces:
52 | fac_gray = gray[y: (y+h), x: (x+w)]
53 | eyes = eyeCascade.detectMultiScale(fac_gray, 1.3, 2)
54 |
55 | # 眼睛坐标的换算,将相对位置换成绝对位置
56 | for (ex, ey, ew, eh) in eyes:
57 | result.append((x+ex, y+ey, ew, eh))
58 |
59 | for (x, y, w, h) in faces:
60 | cv2.rectangle(img, (x, y), (x+w, y+w), (255, 0, 0),2)
61 | for (ex, ey, ew, eh) in result:
62 | cv2.rectangle(img, (ex, ey), (ex+ew, ey+eh), (0, 255, 0), 2)
63 | # 显示捕捉了多少张人脸
64 | font = cv2.FONT_HERSHEY_SIMPLEX
65 | cv2.putText(img, f'count:{str(count)}', (x + 30, y + 30), font, 1, (255, 0, 255), 4)
66 |
67 | count += 1
68 |
69 | img_name = path + '/' + str(face_id) + '_' + str(count) + '.jpg'
70 | # 保存图像(路径不能包含中文)
71 | #cv2.imwrite(img_name, gray[y: y + h, x: x + w])
72 |
73 | #保存图像
74 | cv2.imencode('.jpg', gray[y: y + h, x: x + w])[1].tofile(img_name)
75 |
76 | cv2.imshow('image', img)
77 |
78 | # 保持画面的持续。1ms
79 |
80 | k = cv2.waitKey(1)
81 |
82 | if k == 27: # 通过esc键退出摄像
83 | break
84 | elif count >= catch_num:
85 | break;
86 |
87 | print("\n 人脸信息采集完成")
88 | # 关闭摄像头
89 | camera.release()
90 | cv2.destroyAllWindows()
91 |
92 | if __name__ == '__main__':
93 | path=path()
94 | CatchPICFromVideo(path,100)
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/Model/me.face.model.h5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/Model/me.face.model.h5
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/ModelTraining.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | __author__ = '翁飞龙'
3 | import random
4 | import numpy as np
5 | from sklearn.model_selection import train_test_split
6 | from keras.preprocessing.image import ImageDataGenerator
7 | from keras.models import Sequential
8 | from keras.layers import Dense, Activation, Flatten, Dropout
9 | from keras.layers import Conv2D, MaxPool2D
10 | from keras.optimizers import SGD
11 | from keras.utils import np_utils
12 | from keras.models import load_model
13 | from keras import backend as K
14 | from FaceDateSet import load_dataset, resize_image, IMAGE_SIZE
15 | import warnings
16 | warnings.filterwarnings('ignore')
17 |
18 |
19 | class Dataset:
20 | def __init__(self, path_name):
21 | # 训练集
22 | self.train_images = None
23 | self.train_labels = None
24 | # 验证集
25 | # self.valid_images = None
26 | # self.valid_labels = None
27 | # 测试集
28 | self.test_images = None
29 | self.test_labels = None
30 | # 数据加载路径
31 | self.path_name = path_name
32 | # 当前库采用的维度顺序
33 | self.input_shape = None
34 |
35 | def load(self, img_rows=IMAGE_SIZE, img_cols=IMAGE_SIZE, img_channels=3, nb_classes=2):
36 | # 加载数据集至内存
37 | images, labels = load_dataset(self.path_name)
38 | train_images, test_images, train_labels, test_labels = train_test_split(images, labels, test_size=0.3,
39 | random_state=random.randint(0, 10))
40 | #if K.image_dim_ordering() == 'th':
41 | if K.image_data_format() == 'channels_first':
42 | train_images = train_images.reshape(train_images.shape[0], img_channels, img_rows, img_cols)
43 | test_images = test_images.reshape(test_images.shape[0], img_channels, img_rows, img_cols)
44 | self.input_shape = (img_channels, img_rows, img_cols)
45 | else:
46 | train_images = train_images.reshape(train_images.shape[0], img_rows, img_cols, img_channels)
47 | test_images = test_images.reshape(test_images.shape[0], img_rows, img_cols, img_channels)
48 | self.input_shape = (img_rows, img_cols, img_channels)
49 |
50 | # 输出训练集、测试集的数量
51 | print(train_images.shape[0], 'train samples')
52 | print(test_images.shape[0], 'test samples')
53 | # 我们的模型使用categorical_crossentropy作为损失函数,因此需要根据类别数量nb_classes将
54 | # 类别标签进行one-hot编码使其向量化,在这里我们的类别只有两种,经过转化后标签数据变为二维
55 | train_labels = np_utils.to_categorical(train_labels, nb_classes)
56 | test_labels = np_utils.to_categorical(test_labels, nb_classes)
57 | # 像素数据浮点化以便归一化
58 | train_images = train_images.astype('float32')
59 | test_images = test_images.astype('float32')
60 | # 将其归一化,图像的各像素值归一化到0~1区间
61 | train_images /= 255.0
62 | test_images /= 255.0
63 | self.train_images = train_images
64 | self.test_images = test_images
65 | self.train_labels = train_labels
66 | self.test_labels = test_labels
67 |
68 |
69 | # CNN网络模型类
70 | class Model:
71 | def __init__(self):
72 | self.model = None
73 |
74 | # 建立模型
75 | def build_model(self, dataset, nb_classes=2):
76 | # 构建一个空的网络模型,它是一个线性堆叠模型,各神经网络层会被顺序添加,专业名称为序贯模型或线性堆叠模型
77 | self.model = Sequential()
78 |
79 | # 以下代码将顺序添加CNN网络需要的各层,一个add就是一个网络层
80 | self.model.add(Conv2D(32, 3, 3, border_mode='same',
81 | input_shape=dataset.input_shape)) # 1 2维卷积层
82 | self.model.add(Activation('relu')) # 2 激活函数层
83 |
84 | self.model.add(Conv2D(32, 3, 3)) # 3 2维卷积层
85 | self.model.add(Activation('relu')) # 4 激活函数层
86 |
87 | self.model.add(MaxPool2D(pool_size=(2, 2))) # 5 池化层
88 | self.model.add(Dropout(0.25)) # 6 Dropout层
89 |
90 | self.model.add(Conv2D(64, 3, 3, border_mode='same')) # 7 2维卷积层
91 | self.model.add(Activation('relu')) # 8 激活函数层
92 |
93 | self.model.add(Conv2D(64, 3, 3)) # 9 2维卷积层
94 | self.model.add(Activation('relu')) # 10 激活函数层
95 |
96 | self.model.add(MaxPool2D(pool_size=(2, 2))) # 11 池化层
97 | self.model.add(Dropout(0.25)) # 12 Dropout层
98 |
99 | self.model.add(Flatten()) # 13 Flatten层
100 | self.model.add(Dense(512)) # 14 Dense层,又被称作全连接层
101 | self.model.add(Activation('relu')) # 15 激活函数层
102 | self.model.add(Dropout(0.5)) # 16 Dropout层
103 | self.model.add(Dense(nb_classes)) # 17 Dense层
104 | self.model.add(Activation('softmax')) # 18 分类层,输出最终结果
105 |
106 | # 输出模型概况
107 | self.model.summary()
108 |
109 | # 训练模型
110 | def train(self, dataset, batch_size=20, nb_epoch=100, data_augmentation=True):
111 | sgd = SGD(lr=0.01, decay=1e-6,
112 | momentum=0.9, nesterov=True) # 采用SGD+momentum的优化器进行训练,首先生成一个优化器对象
113 | self.model.compile(loss='categorical_crossentropy',
114 | optimizer=sgd,
115 | metrics=['accuracy']) # 完成实际的模型配置工作
116 |
117 | # 不使用数据提升,所谓的提升就是从我们提供的训练数据中利用旋转、翻转、加噪声等方法创造新的
118 | # 训练数据,有意识的提升训练数据规模,增加模型训练量
119 | if not data_augmentation:
120 | self.model.fit(dataset.train_images,
121 | dataset.train_labels,
122 | batch_size=batch_size,
123 | nb_epoch=nb_epoch,
124 | validation_data=(dataset.test_images, dataset.test_labels),
125 | shuffle=True)
126 | # 使用实时数据提升
127 | else:
128 | # 定义数据生成器用于数据提升,其返回一个生成器对象datagen,datagen每被调用一
129 | # 次其生成一组数据(顺序生成),节省内存,其实就是python的数据生成器
130 | datagen = ImageDataGenerator(
131 | featurewise_center=False, # 是否使输入数据去中心化(均值为0),
132 | samplewise_center=False, # 是否使输入数据的每个样本均值为0
133 | featurewise_std_normalization=False, # 是否数据标准化(输入数据除以数据集的标准差)
134 | samplewise_std_normalization=False, # 是否将每个样本数据除以自身的标准差
135 | zca_whitening=False, # 是否对输入数据施以ZCA白化
136 | rotation_range=20, # 数据提升时图片随机转动的角度(范围为0~180)
137 | width_shift_range=0.2, # 数据提升时图片水平偏移的幅度(单位为图片宽度的占比,0~1之间的浮点数)
138 | height_shift_range=0.2, # 同上,只不过这里是垂直
139 | horizontal_flip=True, # 是否进行随机水平翻转
140 | vertical_flip=False) # 是否进行随机垂直翻转
141 |
142 | # 计算整个训练样本集的数量以用于特征值归一化、ZCA白化等处理
143 | datagen.fit(dataset.train_images)
144 |
145 | # 利用生成器开始训练模型
146 | self.model.fit_generator(datagen.flow(dataset.train_images, dataset.train_labels,
147 | batch_size=batch_size),
148 | samples_per_epoch=dataset.train_images.shape[0],
149 | nb_epoch=nb_epoch,
150 | validation_data=(dataset.test_images, dataset.test_labels))
151 |
152 | MODEL_PATH = './Model/face.model.h5'
153 |
154 | def save_model(self, file_path=MODEL_PATH):
155 | self.model.save(file_path)
156 |
157 | def load_model(self, file_path=MODEL_PATH):
158 | self.model = load_model(file_path)
159 |
160 | def evaluate(self, dataset):
161 | score = self.model.evaluate(dataset.test_images, dataset.test_labels, verbose=1)
162 | # print("%s: %.2f%%" % (self.model.metrics_names[1], score[1] * 100))
163 | print(f'{self.model.metrics_names[1]}:{score[1] * 100}%')
164 |
165 | # 识别人脸
166 | def face_predict(self, image):
167 | # 依然是根据后端系统确定维度顺序
168 | #if K.image_dim_ordering() == 'th'
169 | if K.image_data_format() == 'channels_first'and image.shape != (1, 3, IMAGE_SIZE, IMAGE_SIZE):
170 | image = resize_image(image) # 尺寸必须与训练集一致都应该是IMAGE_SIZE x IMAGE_SIZE
171 | image = image.reshape((1, 3, IMAGE_SIZE, IMAGE_SIZE)) # 与模型训练不同,这次只是针对1张图片进行预测
172 | #elif K.image_dim_ordering() == 'tf'
173 | elif K.image_data_format() == 'channels_last'and image.shape != (1, IMAGE_SIZE, IMAGE_SIZE, 3):
174 | image = resize_image(image)
175 | image = image.reshape((1, IMAGE_SIZE, IMAGE_SIZE, 3))
176 |
177 | # 浮点并归一化
178 | image = image.astype('float32')
179 | image /= 255.0
180 |
181 | # 给出输入属于各个类别的概率,我们是二值类别,则该函数会给出输入图像属于0和1的概率各为多少
182 | result = self.model.predict_proba(image)
183 | print('result:', result)
184 |
185 | # 给出类别预测:0或者1
186 | result = self.model.predict_classes(image)
187 |
188 | # 返回类别预测结果
189 | return result[0]
190 |
191 |
192 | if __name__ == '__main__':
193 | dataset = Dataset('./FaceImageDate/')
194 | dataset.load()
195 |
196 | # 训练模型
197 | model = Model()
198 | model.build_model(dataset)
199 | # 测试训练函数的代码
200 | model.train(dataset)
201 | model.save_model(file_path='./Model/me.face.model.h5')
202 | # 评估模型
203 | model = Model()
204 | model.load_model(file_path='./Model/me.face.model.h5')
205 | model.evaluate(dataset)
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/__pycache__/FaceDateSet.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/__pycache__/FaceDateSet.cpython-37.pyc
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/__pycache__/FaceRecognitionAttendanceSystem.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/__pycache__/FaceRecognitionAttendanceSystem.cpython-37.pyc
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/__pycache__/ImageAcquisition.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/__pycache__/ImageAcquisition.cpython-37.pyc
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/__pycache__/ModelTraining.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/客户端/FaceRecognitionAttendanceSystem/__pycache__/ModelTraining.cpython-37.pyc
--------------------------------------------------------------------------------
/客户端/FaceRecognitionAttendanceSystem/main.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import os
3 | from PyQt5.QtGui import *
4 | from PyQt5.QtWidgets import *
5 | from PyQt5.QtCore import *
6 | import FaceRecognitionAttendanceSystem
7 | # coding:utf-8
8 | def click_ImageAcquisition():
9 | pass
10 | def click_FaceDateSet():
11 | pass
12 | def click_ModelTraining():
13 | pass
14 | def click_FaceRecognition():
15 | pass
16 | if __name__ == '__main__':
17 | app = QApplication(sys.argv)
18 | MainWindow = QMainWindow()
19 | ui = FaceRecognitionAttendanceSystem.Ui_Form()
20 | ui.setupUi(MainWindow)
21 | MainWindow.show()
22 | ui.ImageAcquisition.clicked.connect(click_ImageAcquisition)#绑定成员录入按钮
23 | ui.FaceDateSet.clicked.connect(click_FaceDateSet)#绑定数据处理按钮
24 | ui.ModelTraining.clicked.connect(click_ModelTraining)#绑定模型训练按钮
25 | ui.FaceRecognition.clicked.connect(click_FaceRecognition)#绑定人脸识别按钮
26 |
27 | sys.exit(app.exec_())
--------------------------------------------------------------------------------
/服务端/a.out:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Color-l/FaceRecognitionAttendanceSystem/55b4ba4ef7280a888616f898287ccf7e4caa3807/服务端/a.out
--------------------------------------------------------------------------------
/服务端/server.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | #define BAUDRATE B115200 ///Baud rate : 115200
15 | #define DEVICE "/dev/ttyS1"//设置端口号
16 | #define FALSE 0
17 | #define TRUE 1
18 | #define _POSIX_SOURCE 1 //POSIX系统兼容
19 | int SerialPort_Send(int i){
20 |
21 | int fd,res;
22 | struct termios oldtio,newtio;
23 |
24 | fd=open(DEVICE,O_RDWR | O_NOCTTY);
25 | if(fd<0){
26 | perror(DEVICE);
27 | exit(-1);
28 | }
29 | tcgetattr(fd,&oldtio);//保存原来的参数
30 | bzero(&newtio,sizeof(newtio));
31 | newtio.c_cflag=BAUDRATE | CS8 | CLOCAL | CREAD | HUPCL;
32 | newtio.c_iflag=IGNBRK;
33 | newtio.c_oflag=0;
34 | newtio.c_lflag=ICANON;
35 | tcflush(fd,TCIFLUSH);
36 | tcsetattr(fd,TCSANOW,&newtio);//设置串口参数
37 | printf("%d\n",i);
38 | if(i==0){
39 | char openbuf[255]={0xdd,0x05,0x24,0x00,0x09};
40 | char closebj[255]={0xdd,0x05,0x24,0x00,0x03};
41 | write(fd,openbuf,5);
42 | write(fd,closebj,5);
43 | close(fd);
44 | }
45 | else{
46 | char closebuf[255]={0xdd,0x05,0x24,0x00,0x0a};
47 | char baojing[255]={0xdd,0x05,0x24,0x00,0x02};
48 | write(fd,closebuf,5);
49 | write(fd,baojing,5);
50 | close(fd);
51 | }
52 |
53 | }
54 |
55 | int main()
56 | {
57 | int sockfd, new_fd;
58 | struct sockaddr_in my_addr;
59 | struct sockaddr_in their_addr;
60 | int sin_size;
61 | //建立TCP套接口
62 | if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
63 | {
64 | printf("create socket error");
65 | perror("socket");
66 | exit(1);
67 | }
68 | //初始化结构体,并绑定6666端口
69 | my_addr.sin_family = AF_INET;
70 | my_addr.sin_port = htons(6666);
71 | my_addr.sin_addr.s_addr = INADDR_ANY;
72 | bzero(&(my_addr.sin_zero), 8);
73 | int on;
74 | on = 1;
75 | setsockopt( sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on) );
76 | //绑定套接口
77 | if (bind(sockfd, (struct sockaddr*)&my_addr, sizeof(struct sockaddr)) == -1)
78 | {
79 | perror("bind socket error");
80 | exit(1);
81 | }
82 | //创建监听套接口
83 | if (listen(sockfd, 10) == -1)
84 | {
85 | perror("listen");
86 | exit(1);
87 | }
88 | //等待连接
89 | while (1)
90 | {
91 | sin_size = sizeof(struct sockaddr_in);
92 | printf("server is run......\n");
93 | //如果建立连接,将产生一个全新的套接字
94 | if ((new_fd = accept(sockfd, (struct sockaddr*)&their_addr, &sin_size)) == -1)
95 | {
96 | perror("accept");
97 | exit(1);
98 | }
99 | printf("accept success.\n");
100 | //break;
101 |
102 | //生成一个子进程来完成和客户端的会话,父进程继续监听
103 | if (!fork())
104 | {
105 | printf("create new thred success.\n");
106 | //读取客户端发来的信息
107 | int numbytes;
108 | char buff[1024];
109 | memset(buff, 0, 1024);
110 | if ((numbytes = recv(new_fd, buff, sizeof(buff), 0)) == -1)
111 | {
112 | perror("recv");
113 | exit(1);
114 | }
115 | printf("%s\n", buff);
116 | printf("--------------------------------------------------------\n\n");
117 | int i=(strcmp(buff,"0"));
118 | SerialPort_Send(i);
119 | /*if(i==0)
120 | {
121 | char success[]="success";
122 | if (send(new_fd, success, strlen(success), 0) == -1)
123 | perror("send");
124 | }
125 | else{
126 | char failed[]="failed";
127 | if (send(new_fd, failed, strlen(failed), 0) == -1)
128 | perror("send");
129 | }
130 |
131 | close(new_fd);
132 | exit(0);
133 | }*/
134 | close(new_fd);
135 | }
136 | }
137 | close(sockfd);
138 | }
139 |
--------------------------------------------------------------------------------