This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib.animation import FuncAnimation | |
from mpl_toolkits.mplot3d import Axes3D | |
# numero iteraciones | |
ITERS = 10000 | |
# learning rate | |
LR = 0.0000000001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A = roty(-30); B = 2; C = rotx(45); | |
[A2, B2, C2] = svd(A*B*C); | |
if(sum(sum(abs(A2)-abs(A))) < 1e-10 && ... | |
sum(sum(abs(B2)-abs(B))) < 1e-10 && ... | |
sum(sum(abs(C2)-abs(C))) < 1e-10) | |
disp('La descomposicion da como resultado A, B, C iguales en magnitud'); | |
end |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import keras | |
from keras.preprocessing.image import ImageDataGenerator | |
# Indicamos Cada correspondiente carpeta | |
TRAIN_FOLDER = './dogscats/train/' | |
VAL_FOLDER = './dogscats/valid/' | |
# Indicamos como se cogeran las imagenes de entrenamiento y si habrá data-aumentation. | |
# Basicamente para tener más ejemplos, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cargamos la clase para generar modelos sequenciales | |
from keras.models import Sequential | |
# Cargamos las siguientes capas | |
from keras.layers import Conv2D, MaxPooling2D, Dense, Flatten | |
model = Sequential() | |
# Bloque 1: | |
# - Conv1a: neuronas=128, ventana=(3,3), activacion=ReLU. | |
# - Conv1b: neuronas=256, ventana=(3,3), activacion=ReLU. | |
# - Max-pooling: ventana=(3,3), stride=2. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usamos el optimizador Adam | |
# Usamos la loss function binary_crossentropy. Esta es util cuando la red devuelve una probabilidad, es este caso ser perro o ser gato. | |
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['binary_accuracy']) | |
model.summary() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usamos fit generator para aprender. | |
# Definimos 50 epocas y 2000 iteraciones/epoca | |
# Indicamos que datos usaremos para validar el correcto aprendizaje y diagnostico | |
model.fit_generator( | |
train_generator, | |
steps_per_epoch=2000, | |
epochs=50, | |
validation_data=val_generator, | |
validation_steps=800) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse, keras, os | |
from keras.models import model_from_json | |
parser = argparse.ArgumentParser() | |
parser.add_argument("image", help="Image or folder of images to predict", | |
type=str) | |
args = parser.parse_args() | |
# Cargamos el modelo | |
json_file = open('model.json', 'r') | |
loaded_model_json = json_file.read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse, keras, os, cv2 | |
from keras.models import model_from_json | |
parser = argparse.ArgumentParser() | |
parser.add_argument("image", help="Image or folder of images to predict", | |
type=str) | |
args = parser.parse_args() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cargamos el modelo | |
json_file = open('model.json', 'r') | |
loaded_model_json = json_file.read() | |
json_file.close() | |
model = model_from_json(loaded_model_json) | |
model.load_weights("model.h5") |
OlderNewer