Browse Source

module iss

dev
Francois 1 year ago
parent
commit
14ad2c0492
25 changed files with 80 additions and 0 deletions
  1. +0
    -0
      iss/__init__.py
  2. +0
    -0
      iss/data/.gitkeep
  3. +48
    -0
      iss/data/DataBaseManager.py
  4. +0
    -0
      iss/data/__init__.py
  5. +2
    -0
      iss/data/database_init.py
  6. +0
    -0
      iss/data/make_dataset.py
  7. +0
    -0
      iss/data/resize_collections.py
  8. +0
    -0
      iss/data/sync_collections.py
  9. +8
    -0
      iss/data/sync_collections.sh
  10. +0
    -0
      iss/features/.gitkeep
  11. +0
    -0
      iss/features/__init__.py
  12. +0
    -0
      iss/features/build_tfrecords.py
  13. +0
    -0
      iss/models/.gitkeep
  14. +0
    -0
      iss/models/__init__.py
  15. +0
    -0
      iss/models/base_model.py
  16. +0
    -0
      iss/models/data_loader.py
  17. +0
    -0
      iss/models/predict_model.py
  18. +0
    -0
      iss/models/train_model.py
  19. +0
    -0
      iss/models/trainer_model.py
  20. +0
    -0
      iss/tools/__init__.py
  21. +22
    -0
      iss/tools/config.py
  22. +0
    -0
      iss/untitled.txt
  23. +0
    -0
      iss/visualization/.gitkeep
  24. +0
    -0
      iss/visualization/__init__.py
  25. +0
    -0
      iss/visualization/visualize.py

src/__init__.py → iss/__init__.py View File


src/data/.gitkeep → iss/data/.gitkeep View File


+ 48
- 0
iss/data/DataBaseManager.py View File

@@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-


class DataBaseManager:

def __init__(self, connexion, config):
self.conn = connexion
self.config = config
self.cursor = self.conn.cursor()


def createPicturesTable(self, force = False):

if force:
self.cursor.execute("DROP TABLE IF EXISTS `iss`.`pictures`;")

self.cursor.execute("""
CREATE TABLE `iss`.`pictures` (
`pictures_latitude` FLOAT(10, 6) NULL,
`pictures_longitude` FLOAT(10, 6 ) NULL ,
`pictures_id` VARCHAR( 15 ) PRIMARY KEY ,
`pictures_timestamp` TIMESTAMP NULL ,
`pictures_location` TEXT NULL
) ENGINE = MYISAM ;
""")


def insertRowPictures(self, array):

sql_insert_template = "INSERT INTO `iss`.`pictures` (pictures_latitude, pictures_longitude, pictures_id, pictures_timestamp, pictures_location) VALUES (%s, %s, %s, %s, %s);"

self.cursor.executemany(sql_insert_template, array)
self.conn.commit()

return self.cursor.rowcount

def select(self, array):
sql = """
SELECT tmp.* FROM (
SELECT
COUNT(*) as nb,
pictures_location as location

FROM iss.pictures
GROUP BY pictures_location
) as tmp
ORDER BY nb DESC
"""

src/data/__init__.py → iss/data/__init__.py View File


+ 2
- 0
iss/data/database_init.py View File

@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-


src/data/make_dataset.py → iss/data/make_dataset.py View File


src/data/resize_collections.py → iss/data/resize_collections.py View File


src/data/sync_collections.py → iss/data/sync_collections.py View File


+ 8
- 0
iss/data/sync_collections.sh View File

@@ -0,0 +1,8 @@
#!/bin/sh


## synchroniser avec les images déjà collectées

rsync -rve ssh my-deblan:~/projets/ISS-HDEV-wallpaper/Collections/ ~/Projets/smart-iss-posts/data/raw/collections/

scp -v ssh my-deblan:~/projets/ISS-HDEV-wallpaper/history.txt ~/Projets/smart-iss-posts/data/raw/history/

src/features/.gitkeep → iss/features/.gitkeep View File


src/features/__init__.py → iss/features/__init__.py View File


src/features/build_tfrecords.py → iss/features/build_tfrecords.py View File


src/models/.gitkeep → iss/models/.gitkeep View File


src/models/__init__.py → iss/models/__init__.py View File


src/models/base_model.py → iss/models/base_model.py View File


src/models/data_loader.py → iss/models/data_loader.py View File


src/models/predict_model.py → iss/models/predict_model.py View File


src/models/train_model.py → iss/models/train_model.py View File


src/models/trainer_model.py → iss/models/trainer_model.py View File


src/visualization/__init__.py → iss/tools/__init__.py View File


+ 22
- 0
iss/tools/config.py View File

@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-

import os
import sys
import yaml
from dotenv import find_dotenv, load_dotenv

load_dotenv(find_dotenv())

class Config:

def __init__(self, project_dir = os.getenv("PROJECT_DIR"), mode = os.getenv("MODE")):

self.project_dir = project_dir
self.mode = mode

with open(os.path.join(self.project_dir, 'config', 'config_%s.yaml' % (self.mode)), 'r') as ymlfile:
self.config = yaml.load(ymlfile)

def get(self, key):
return self.config[key]


src/data/sync_collections → iss/untitled.txt View File


src/visualization/.gitkeep → iss/visualization/.gitkeep View File


src/data/sync_collections.chkpt → iss/visualization/__init__.py View File


src/visualization/visualize.py → iss/visualization/visualize.py View File


Loading…
Cancel
Save