Commit aab57840 authored by mihaivanea's avatar mihaivanea
Browse files

Wrote the generator for FDDB.

parent 5266270b
from facenet import demo_cam
from benchmark import run
import sys
import os
from . import transfer_learning
......@@ -404,4 +404,4 @@ def run(dataset):
#print(str(factor))
process_dataset(dataset, path_and_labels_src, t1, t2, t3, factor)
run(argv[6])
#run(argv[6])
from . import generate_arrays_fddb
#!/vol/bitbucket/mv1315/urop/venv/bin/python3.5
import imp
facenet = imp.load_source("detect_face",
"/vol/bitbucket/mv1315/urop/facenet/facenet/detect_face.py")
benchmark = imp.load_source("benchmark",
"/vol/bitbucket/mv1315/urop/benchmark.py")
import numpy as np
from skimage.io import imread
from os import system
from sys import stdout, argv
# generate arrays only for a minibatch for now"
path = "../fddb/FDDB-folds/FDDB-fold-01.txt"
path = "../fddb/FDDB-folds/FDDB-fold-01-ellipseList.txt"
def conver_to_cartesian(ellip_array):
result = []
for ellip in ellip_array:
ellip = [e for e in ellip.rstrip('\n').split(' ')]
major_r = float(ellip[0])
minor_r = float(ellip[1])
c_x = float(ellip[3])
c_y = float(ellip[4])
x1 = c_x - minor_r
y1 = c_y - major_r
x2 = c_x + minor_r
y2 = c_y + major_r
box = [round(p, 4) for p in (x1, y1, x2, y2)]
result.append(box)
return result
def generate_arrays_fddb(path):
image_paths = [line.rstrip('\n') for line in open(path)]
for img in image_paths:
data = imread("fddb/" + img + ".jpg")
target_path = img[:(len(img) - 4)] + "-ellipseList" + img[(len(img) - 4):]
target =
yield (data, target)
no_labels, labels = (l for l in benchmark.tokenise(path))
for lb in labels:
img = lb[0]
data = imread("../fddb/" + img + ".jpg")
yield data, conver_to_cartesian(lb[2])
generator = generate_arrays_fddb(path)
for g in generator:
print(g)
print("HERE")
for g in generator:
print(g)
print("HERE")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment