Browse Source

create mosaic poster

dev
Francois Vieille 4 months ago
parent
commit
19914e78e5
12 changed files with 64 additions and 9 deletions
  1. +12
    -1
      .gitignore
  2. +15
    -0
      Makefile
  3. +20
    -2
      README.md
  4. +0
    -0
      data/interim/.gitkeep
  5. +0
    -0
      data/isr/.gitkeep
  6. BIN
      data/poster_1.jpg
  7. BIN
      data/poster_2.jpg
  8. BIN
      data/poster_3.jpg
  9. +0
    -0
      data/posters/.gitkeep
  10. +0
    -0
      data/processed/.gitkeep
  11. +0
    -0
      data/raw/.gitkeep
  12. +17
    -6
      iss/exec/posters.py

+ 12
- 1
.gitignore 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


+ 15
- 0
Makefile 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 #


+ 20
- 2
README.md 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
@@ -76,4 +83,15 @@ donne : (en 150 dpi)

48.77cm x 73.15cm

bordure de 60px pour 1 cm en 150dpi
bordure de 60px pour 1 cm en 150dpi

version2 :

* e63e25b
* df89064
* d4cb94
* c2ff00
* 2e58ed9 : ok
* 2b11acbe
* 2575f6
* 1b4cb13: ok

+ 0
- 0
data/interim/.gitkeep View File


+ 0
- 0
data/isr/.gitkeep View File


BIN
data/poster_1.jpg View File

Before After
Width: 4410  |  Height: 2970  |  Size: 1.1MB

BIN
data/poster_2.jpg View File

Before After
Width: 4410  |  Height: 2970  |  Size: 973KB

BIN
data/poster_3.jpg View File

Before After
Width: 4410  |  Height: 2970  |  Size: 1.0MB

+ 0
- 0
data/posters/.gitkeep View File


+ 0
- 0
data/processed/.gitkeep View File


+ 0
- 0
data/raw/.gitkeep View File


+ 17
- 6
iss/exec/posters.py 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()

Loading…
Cancel
Save