The repository contains scripts that generate averaged depth image and reconstruct given image.
Sample dataset is located in dataset folder. It contains images of human faces of size 116x120. Images in test set have arbitrary distributed missing part.
Original image | Reconstructed using symmetry | Reconstructed using average image and symmetry |
---|---|---|
- Ubuntu 18.04
- Python 3.7.4
- numpy 1.17.2
- pillow 6.2.0
git clone https://github.com/Robator/face_reconstruction.git
pip install -r requirements.txt
python main.py train dataset/train
Reconstruct images in test folder run and store results in dataset/rec_images folder run:
python main.py test dataset/test --out=dataset/rec_images
To run tests run from the root directory:
./scripts/tests.sh
When train is launched, an average image is created in the following way. At the first iteration, the average image equals to the first image(or the first batch). By default, batch size equals to 1 Next, the intersection area between the current and the average image is taken and average pixel values between current(or batch) and average image are calculated for each image in dataset.
When inferencing, the algorithm tries to replace white areas. For each such pixel symmetrical to vertical image line pixel value is used if it is not white otherwise value from an average image.
- In case face on an image to reconstruct is wider than on an average one and the missing area is in that place, hollows may appear
Contact me on Linkedin