Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
flask/.DS_Store
notebooks/.DS_Store
58 changes: 56 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,56 @@
# face
Predicting the Current Face of Missing Children
# CV Project

- <b>Course: YearDraem School 2nd (Track CV)</b>
- <b>Project period: 21 Jul. ~ 5 Aug., 2022</b>
- <b>Team members & roles</b>
#### 권오균(O. Kwon) : model search, code modify and apply, paper review, data search, flask web implementation, ppt production.
#### 홍승현(S. Hong) : flask web implementation(input page), data search, model search.
#### 김지혜(J. Kim) : team leader, flask web implementation(output page), ppt production, presentation, data search.
#### 권민경(M. Kwon) : ppt production, model search, data search, paper review.
#### 이진석(J. Lee) : model search, paper review, code modify support, flask web implementation support, meeting report.
- <b>Stacks</b>

![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54)
![PyTorch](https://img.shields.io/badge/PyTorch-%23EE4C2C.svg?style=for-the-badge&logo=PyTorch&logoColor=white)
![Anaconda](https://img.shields.io/badge/Anaconda-%2344A833.svg?style=for-the-badge&logo=anaconda&logoColor=white)
![OpenCV](https://img.shields.io/badge/opencv-%23white.svg?style=for-the-badge&logo=opencv&logoColor=white)
![NumPy](https://img.shields.io/badge/numpy-%23013243.svg?style=for-the-badge&logo=numpy&logoColor=white)
![SciPy](https://img.shields.io/badge/SciPy-%230C55A5.svg?style=for-the-badge&logo=scipy&logoColor=%white)


![Google Colab](https://img.shields.io/badge/Google%20Colab-F9AB00?style=for-the-badge&logo=googlecolab&logoColor=white)
![Google Drive](https://img.shields.io/badge/Google%20Drive-4285F4?style=for-the-badge&logo=googledrive&logoColor=white)
![Visual Studio Code](https://img.shields.io/badge/Visual%20Studio%20Code-0078d7.svg?style=for-the-badge&logo=visual-studio-code&logoColor=white)
![Jupyter Notebook](https://img.shields.io/badge/jupyter-%23FA0F00.svg?style=for-the-badge&logo=jupyter&logoColor=white)

![Flask](https://img.shields.io/badge/flask-%23000.svg?style=for-the-badge&logo=flask&logoColor=white)
![HTML5](https://img.shields.io/badge/html5-%23E34F26.svg?style=for-the-badge&logo=html5&logoColor=white)
![CSS3](https://img.shields.io/badge/css3-%231572B6.svg?style=for-the-badge&logo=css3&logoColor=white)
![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E)
![Bootstrap](https://img.shields.io/badge/bootstrap-%23563D7C.svg?style=for-the-badge&logo=bootstrap&logoColor=white)

![Notion](https://img.shields.io/badge/Notion-%23000000.svg?style=for-the-badge&logo=notion&logoColor=white)
![GitHub](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)


## Project topic
### Missing Children Current Face Prediction

#### The reason we chose this topic

##### All the team members wanted to try the face detecting and CycleGAN series models, and while looking for a suitable model, we found Lifespan Age Transformation Synthesis (LATS) and decided to try it.
[LATS] https://github.com/royorel/Lifespan_Age_Transformation_Synthesis
##### Then, after thinking about how to use the model we found, We thought it would be good to predict the present state of the children who was lost, so we started this project.

## Why using colab
##### The first plan was to implement a web service through flask in the local environment.
##### However, the computer we are using is an M1 imac, there is a compatibility issue with pytorch and it is difficult to use the GPU, so we decided to implement it through google colab. We used ngrok to run flask in colab.

## Flask Web implement result

![ezgif-2-6189335993](https://user-images.githubusercontent.com/87400909/182803440-dc213fd9-9594-4487-a8b0-78ebb8a61899.gif)

## Presentation

![CV_오프라인-1조](https://user-images.githubusercontent.com/87400909/182988156-8bcfc09a-a6e7-4618-a7dc-144d6f3000f6.gif)

13 changes: 13 additions & 0 deletions data/base_dataset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### Copyright (C) 2020 Roy Or-El. All rights reserved.
### Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
import torch.utils.data as data

class BaseDataset(data.Dataset):
def __init__(self):
super(BaseDataset, self).__init__()

def name(self):
return 'BaseDataset'

def initialize(self, opt):
pass
39 changes: 39 additions & 0 deletions data/data_loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
### Copyright (C) 2020 Roy Or-El. All rights reserved.
### Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
import torch.utils.data
from data.multiclass_unaligned_dataset import MulticlassUnalignedDataset
from pdb import set_trace as st

class AgingDataLoader():
def name(self):
return 'AgingDataLoader'

def initialize(self, opt):
self.opt = opt
self.dataset = CreateDataset(opt)
self.dataloader = torch.utils.data.DataLoader(
self.dataset,
batch_size=opt.batchSize,
shuffle=not opt.serial_batches,
drop_last=True,
num_workers=int(opt.nThreads))

def load_data(self):
return self.dataloader

def __len__(self):
return min(len(self.dataset), self.opt.max_dataset_size)


def CreateDataset(opt):
dataset = MulticlassUnalignedDataset()
print("dataset [%s] was created" % (dataset.name()))
dataset.initialize(opt)
return dataset


def CreateDataLoader(opt):
data_loader = AgingDataLoader()
print(data_loader.name())
data_loader.initialize(opt)
return data_loader
62 changes: 62 additions & 0 deletions data/dataset_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
### Copyright (C) 2020 Roy Or-El. All rights reserved.
### Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
import os
from PIL import Image
import torchvision.transforms as transforms
import numpy as np
import random
from pdb import set_trace as st

IMG_EXTENSIONS = [
'.jpg', '.JPG', '.jpeg', '.JPEG',
'.png', '.PNG',
]


def is_image_file(filename):
return any(filename.endswith(extension) for extension in IMG_EXTENSIONS)


def list_folder_images(dir, opt):
images = []
parsings = []
assert os.path.isdir(dir), '%s is not a valid directory' % dir
for fname in os.listdir(dir):
if is_image_file(fname):
path = os.path.join(dir, fname)
# make sure there's a matching parsings for the image
# parsing files must be png
parsing_fname = fname[:-3] + 'png'
if os.path.isfile(os.path.join(dir, 'parsings', parsing_fname)):
parsing_path = os.path.join(dir, 'parsings', parsing_fname)
images.append(path)
parsings.append(parsing_path)

# sort according to identity in case of FGNET test
if 'fgnet' in opt.dataroot.lower():
images.sort(key=str.lower)
parsings.sort(key=str.lower)

return images, parsings

def get_transform(opt, normalize=True):
transform_list = []

if opt.resize_or_crop == 'resize_and_crop':
osize = [opt.loadSize, opt.loadSize]
transform_list.append(transforms.Resize(osize, interpolation=Image.NEAREST))
transform_list.append(transforms.RandomCrop(opt.fineSize))
elif opt.resize_or_crop == 'crop':
transform_list.append(transforms.RandomCrop(opt.fineSize))

if opt.isTrain and not opt.no_flip:
transform_list.append(transforms.RandomHorizontalFlip())

transform_list += [transforms.ToTensor()]

if normalize:
mean = (0.5,)
std = (0.5,)
transform_list += [transforms.Normalize(mean,std)]

return transforms.Compose(transform_list)
Loading