Giter Site home page Giter Site logo

face-recognition-in-presence-of-mask's Introduction

Face recognition in presence of mask

The task in this project is to match a face image without any occlusion with a face image covered with one of these masking approaches. This repo is a solution of summer challenge given by IITJ.

Demo

01-1arrow01-2

02-1arrow02-2

Steps to run

  1. Clone this repository
git clone https://github.com/Garvit-32/Face-recognition-in-presence-of-Mask.git
  1. Install all the dependencies
pip install -r requirements.txt
  1. Download and paste the pretrained weight of face detection model in ./face_detection/weights/ using the link
  2. Download the hand made dataset using the link ~ 110 MB
  3. Extract and paste it in project root directory
  4. (optional) You can use your dataset also but it follow a specific structure of directory
-dataset/
	-person_name_1/
		-image_01
		-image_02
	-person_name_2/
		-image_01
		-image_02
  1. Run generate_database python file to virtually append mask on person face in database
python generate_database.py
  1. Train the model
python train.py

Steps to Test it out

  1. Extract face in image using extract_face.py edit test_data_path = "to_your_test_path"
python extract_face.py
  1. Test your image
python test.py

face-recognition-in-presence-of-mask's People

Contributors

garvit-32 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

face-recognition-in-presence-of-mask's Issues

NameError: name 'get_transforms' is not defined

python train.py

Traceback (most recent call last):
File "train.py", line 20, in
trfm = get_transforms(do_flip=True, flip_vert=True, max_zoom=1.2, max_rotate=20.0, max_lighting=0.4)
NameError: name 'get_transforms' is not defined

The "freeze_support()" line can be omitted if the program is not going to be frozen to produce an executable.

C:\Users\anjuk\anaconda3_1\envs\face\lib\site-packages\torch\nn\functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at ..\c10/core/TensorImpl.h:1156.)
return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode)
epoch train_loss valid_loss error_rate accuracy time
C:\Users\anjuk\anaconda3_1\envs\face\lib\site-packages\torch\nn\functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at ..\c10/core/TensorImpl.h:1156.)
return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode)
epoch train_loss valid_loss error_rate accuracy time
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\multiprocessing\spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\multiprocessing\spawn.py", line 125, in _main
prepare(preparation_data)
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\multiprocessing\spawn.py", line 233, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\multiprocessing\spawn.py", line 284, in _fixup_main_from_path
main_content = runpy.run_path(main_path,
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\runpy.py", line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\iiitdm\RESEARCH\Face-recognition-in-presence-of-Mask-master\Face-recognition-in-presence-of-Mask-master\train.py", line 34, in
learn.fit_one_cycle(6, max_lr =[1e-6, 1e-4, 1e-3])
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\site-packages\fastai\train.py", line 23, in fit_one_cycle
learn.fit(cyc_len, max_lr, wd=wd, callbacks=callbacks)
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\site-packages\fastai\basic_train.py", line 200, in fit
fit(epochs, self, metrics=self.metrics, callbacks=self.callbacks+callbacks)
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\site-packages\fastai\basic_train.py", line 99, in fit
for xb,yb in progress_bar(learn.data.train_dl, parent=pbar):
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\site-packages\fastprogress\fastprogress.py", line 47, in iter
raise e
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\site-packages\fastprogress\fastprogress.py", line 41, in iter
for i,o in enumerate(self.gen):
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\site-packages\fastai\basic_data.py", line 75, in iter
for b in self.dl: yield self.proc_batch(b)
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\site-packages\torch\utils\data\dataloader.py", line 359, in iter
return self._get_iterator()
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\site-packages\torch\utils\data\dataloader.py", line 305, in _get_iterator
return _MultiProcessingDataLoaderIter(self)
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\site-packages\torch\utils\data\dataloader.py", line 918, in init
w.start()
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\multiprocessing\process.py", line 121, in start
self._popen = self._Popen(self)
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\multiprocessing\context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\multiprocessing\context.py", line 327, in _Popen
return Popen(process_obj)
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\multiprocessing\popen_spawn_win32.py", line 45, in init
prep_data = spawn.get_preparation_data(process_obj._name)
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\multiprocessing\spawn.py", line 151, in get_preparation_data
_check_not_importing_main()
File "C:\Users\anjuk\anaconda3_1\envs\face\lib\multiprocessing\spawn.py", line 134, in _check_not_importing_main
raise RuntimeError('''
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if name == 'main':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.