create mosaic poster

This commit is contained in:
Francois Vieille 2020-01-21 01:29:01 +01:00
parent f9b8a08b63
commit 19914e78e5
12 changed files with 64 additions and 9 deletions

13
.gitignore vendored
View File

@ -76,7 +76,18 @@ target/
.ipynb_checkpoints/
# exclude data from source control by default
/data/
# /data/
data/interim/*
data/isr/*
data/posters/*
data/processed/*
data/raw/*
data/tmp/*
!data/**/.gitkeep
# reports
reports/*.html
reports/figures/*.png
# Mac OS-specific storage files
.DS_Store

View File

@ -47,6 +47,18 @@ debug:
config_template:
$(PYTHON_INTERPRETER) iss/tools/config_template.py
## start docker
docker_start:
docker-compose up -d
## stop docker
docker_stop:
docker-compose stop
## docker exec bash
docker_bash:
docker exec --user=jovyan -it jupyter-iss /bin/bash
#################################################################################
# PROJECT RULES #
@ -68,6 +80,9 @@ training:
exec_clustering:
$(PYTHON_INTERPRETER) -m iss.exec.clustering
posters:
$(PYTHON_INTERPRETER) -m iss.exec.posters --config-id=1 --generate=1 --poster-id='test'
#################################################################################
# OUTSIDE CONTAINER #

View File

@ -5,6 +5,13 @@ _Work In Progress_
Project to identify nice pics from live ISS
## Poster examples
![Poster 1](data/poster_1.jpg)
![Poster 2](data/poster_2.jpg)
![Poster 3](data/poster_3.jpg)
Project Organization
------------
@ -59,7 +66,7 @@ Project Organization
<p><small>Project based on the <a target="_blank" href="https://drivendata.github.io/cookiecutter-data-science/">cookiecutter data science project template</a>. #cookiecutterdatascience</small></p>
## Size
## Personal Note:
original size : 1280x720
cut size : 48x27
@ -77,3 +84,14 @@ donne : (en 150 dpi)
48.77cm x 73.15cm
bordure de 60px pour 1 cm en 150dpi
version2 :
* e63e25b
* df89064
* d4cb94
* c2ff00
* 2e58ed9 : ok
* 2b11acbe
* 2575f6
* 1b4cb13: ok

0
data/interim/.gitkeep Normal file
View File

0
data/isr/.gitkeep Normal file
View File

BIN
data/poster_1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
data/poster_2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 973 KiB

BIN
data/poster_3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

0
data/posters/.gitkeep Normal file
View File

0
data/processed/.gitkeep Normal file
View File

0
data/raw/.gitkeep Normal file
View File

View File

@ -3,6 +3,7 @@ import numpy as np
import random
import uuid
import PIL
import click
from PIL import ImageDraw, ImageFont
from iss.init_config import CONFIG
from iss.tools import Tools
@ -20,8 +21,6 @@ from iss.tools import Tools
BORDER_SIZE = 30
O_WIDTH = 1080
O_HEIGHT = 720
N_GENERATE = 1
POSTER_ID = 'secret_santa_lincoln'
CLUSTERS = {
'horizon_only': [2, 6, 20, 23, 27, 44, 47],
'horizon_iss': [4, 5, 12, 17, 32, 37, 40],
@ -108,7 +107,7 @@ POSTERS_CONFIG = [{
## Fonctions
##
def pictures_df(config, db_manager, config_poster):
def get_pictures_df(config, db_manager, poster_config):
req_sql = "SELECT * FROM iss.pictures_embedding WHERE clustering_version = %s AND clustering_model_type = %s AND clustering_model_name = %s"
@ -208,17 +207,25 @@ def write_poster_picture(config, poster_config, poster, poster_id = None):
## Main
##
if __name__ == '__main__':
@click.command()
@click.option('--config-id', default=1, show_default=True, type=int)
@click.option('--generate', default=1, show_default=True, type=int)
@click.option('--poster-id', default=None, show_default=True, type=str)
def main(config_id, generate, poster_id):
N_GENERATE = generate
POSTER_ID = poster_id
db_manager = Tools.create_db_manager(CONFIG)
## creation de la base
db_manager.create_posters_table()
##
poster_config = POSTERS_CONFIG[2]
poster_config = POSTERS_CONFIG[config_id]
##
pictures_df = pictures_df(CONFIG, db_manager, poster_config)
pictures_df = get_pictures_df(CONFIG, db_manager, poster_config)
##
poster = create_empty_poster(CONFIG, poster_config)
@ -239,3 +246,7 @@ if __name__ == '__main__':
##
write_poster_picture(CONFIG, poster_config, poster, poster_id)
if __name__ == '__main__':
main()