-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·86 lines (63 loc) · 2.53 KB
/
Copy pathmain.py
File metadata and controls
executable file
·86 lines (63 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# -*- coding: utf-8 -*-
"""
Pruebas para el algoritmo propuesto kNN-Sparse
Tomás Larrain A.
6 de junio de 2014
"""
import utils.miscUtils as miscUtils
import utils.testUtils as testUtils
import time
import numpy as np
# Parámetros
m = 1225 # Cantidad de patches seleccionados por foto para A
m2 = 900 # Cantidad de patches para Matriz S
height = 100 # Alto del resize de la imagen
width = 100 # Ancho del resize de la imagen
w = 20 # Alto del patch
alpha = 0.5 # Peso del centro
Q = 50 # Cluster Padres
R = 40 # Cluser Hijos
L = 4 # Cantidad de elementos en repr. sparse
SCIThreshold = 0.1 # Umbral de seleccion de patches
tanTriggs = True # Utilizar normalizacion de Tan-Triggs
grilla = True
# Datos de entrada del dataset
dataBase = "MPIE"
# Datos de entrada del Test
cantIteraciones = 50
cantPersonas = 68
cantPhotosDict = 12
# Variables de display
displayResults = True
display = False # Desplegar resultados
dispWidth = 30 # Ancho de las imágenes desplegadas
dispHeight = 30 # Alto de las imágenes desplegadas
sensibilidad = False
fecha = time.asctime(time.localtime(time.time()))
########################
# EXPERIMENTOS SIMPLES #
########################
testType = 'short'
if testType == 'short':
print 'SHORT TEST'
header = miscUtils.testResultsHeader(dataBase, tanTriggs, grilla, cantPersonas, cantPhotosDict, cantIteraciones, fecha)
print header
# print "Random Corners"
variables = miscUtils.testVariables(m, m2, height, width, w, alpha, Q, R, L, SCIThreshold)
print variables
trainTimeAcumulado, testTimeAcumulado, tiemposAcumulado, itResults = testUtils.mainAlgorithm(m, m2, height, width, w, alpha, Q, R, L, SCIThreshold, tanTriggs, dataBase,
cantIteraciones, cantPersonas, cantPhotosDict, display, displayResults, dispHeight, dispWidth, sensibilidad, grilla)
timeResult = miscUtils.timeResults(tiemposAcumulado, cantIteraciones)
print header
print timeResult
results = miscUtils.testResults(cantPersonas, trainTimeAcumulado, testTimeAcumulado, itResults)
print results
###################################################
##########################
# EXPERIMENTOS MULTIPLES # Si se quiere editar hay que ir a testUtils.py (algunos datos de entrada se crean alla)
##########################
if testType == 'long':
print 'LONG TEST'
testContent = testUtils.mainLongTest(m, m2, height, width, w, alpha, Q, R, L, SCIThreshold, tanTriggs, dataBase,
cantIteraciones, cantPersonas, cantPhotosDict, display, displayResults, dispHeight, dispWidth, sensibilidad, grilla, fecha)
print testContent