Exemple #1
0
def create_color(name):
    """Create color"""

    color = Color(name=name)
    db.session.add(color)
    db.session.commit()

    return color
Exemple #2
0
def add_color_data(hex_code, color_name):
    """Assume hex_code is a 7-character string that's a hex code.
    Add it to the database."""

    color = Color(hex_code=hex_code.rstrip().lower(),
                      color_name=color_name.rstrip().lower())
    db.session.add(color)
    try:
        db.session.commit()
    except (Exception, exc.SQLAlchemyError, exc.InvalidRequestError, exc.IntegrityError) as e:
        print(hex_code + '\n' + str(e))
Exemple #3
0
def load_colors():
    """Load colors/hex from css3 dict into database."""

    print "Color"

    for key, value in css3_hex_to_names.items():
        color_hex, color_name = key, value
        color = Color(color_hex=color_hex, color_name=color_name)

        db.session.add(color)

    db.session.commit()
Exemple #4
0
def load_color():
    "Load colors from colors into database"

    print "Colors"

    for row in open("seed_data/colors"):
        color_name = row.rstrip()

        color_name = Color(color=color_name)

        db.session.add(color_name)

    db.session.commit()
def load_colors(color_filename):
    """Load colors from seed_data/generic_colors into database."""

    # Delete all rows in table, so if we need to run this a second time,
    # we won't be trying to add duplicate users
    Color.query.delete()

    #Read generic_colors file and insert data
    for row in open(color_filename):
        row = row.rstrip()
        color_id, color = row.split("|")

        colors = Color(color=color)

        # We need to add to the session or it won't ever be stored
        db.session.add(colors)

    # Once we're done, we should commit our work
    db.session.commit()

    #finished the function
    print("Colors inserted")
import cv2 as cv
import dlib
import numpy as np

from gender_clasification import gender_faces
from logo_detector import run_template_detector
from model import Color, Box, Point, Face, GenderedFace
from utils import create_output_dir, load_and_sort_dir, write_boxes

DETECTION_MODEL = "models/face_detection/res10_300x300_ssd_iter_140000.caffemodel"
DETECTION_MODEL_CONFIG = "models/face_detection/deploy.prototxt.txt"
RECOGNITION_MODEL = 'models/face_recognition/dlib_face_recognition_resnet_model_v1.dat'
SHAPE_MODEL = 'models/face_recognition/shape_predictor_5_face_landmarks.dat'
DETECTION_NETWORK_INPUT_SIZE = 300, 300
# Value from https://towardsdatascience.com/face-detection-models-which-to-use-and-why-d263e82c302c
BLOB_MEAN_SUBTRACTION: Color = Color(r=123, b=104, g=117)
"""
Challenge track robust to cuts
"""


@dataclass
class TrackedFace(GenderedFace):
    id_: int = None
    tracker: dlib.correlation_tracker = None
    staleness: int = 0


class FaceTracker:
    def __init__(
        self,