Skip to content

Instantly share code, notes, and snippets.

Avatar

Pablo Formoso Estrada pabloformoso

View GitHub Profile
View vgg16_keras_transferlearning.py
rom keras import applications
from keras import optimizers
from keras.models import Sequential, Model
from keras.layers import Dropout, Flatten, Dense
from keras import backend as k
from pprint import pprint as pp
img_width, img_height = 300, 300
train_data_dir = "/train"
validation_data_dir = "/validation"
@pabloformoso
pabloformoso / VGG16_Keras_OutOfTheBox.py
Created Apr 26, 2018
Built in VGG16 network with Keras
View VGG16_Keras_OutOfTheBox.py
from keras.optimizers import SGD
from keras.applications.vgg16 import VGG16
model = VGG16(weight='imagenet', include_top=True)
sgd = SGD(lr=0.1, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(optimizer=sgd, loss='categorical)
View VGG16_Keras.py
def VGG16(weights_path=None):
model = Sequential()
model.add(ZeroPadding2D((1,1),input_shape=(224,224,3)))
model.add(Convolution2D(64, (3, 3), activation='relu', padding='same', name='block1_conv1'))
model.add(Convolution2D(64, (3, 3), activation='relu', padding='same', name='block1_conv2'))
model.add(MaxPooling2D((2,2), strides=(2,2), name='block1_pool'))
model.add(Convolution2D(128, (3, 3), activation='relu', padding='same', name='block2_conv1'))
model.add(Convolution2D(128, (3, 3), activation='relu', padding='same', name='block2_conv2'))
View clean_description.rake
require File.expand_path(File.dirname(__FILE__) + "/../sanitize_tinymce_text")
include SanitizeTinymceText
namespace :html do
desc "Limpiar descripciones guarrillas con css inline y spans"
task :clean => :environment do
Publication.all.each do |pub|
pub.abstract = sanitize_text(pub.abstract)
pub.save
View Install ImageMagick + RMagick
# Pasos para compilar ImageMagick e instalar RMagick en Debian
# Gracias a Ivan Belmonte (@ibelmonte)
#
# Instalar las dependencias de ImageMagick para poderlo compilar
sudo apt-get install libjpeg62-dev libbz2-dev libtiff4-dev libwmf-dev libz-dev libpng12-dev libx11-dev libxt-dev libxext-dev libxml2-dev libfreetype6-dev liblcms1-dev libexif-dev perl libjasper-dev libltdl3-dev graphviz gs-gpl pkg-config
# Compilar ImageMagick para que se pueda instalar luego RMagick, que requiere la versión 6.3+ y Debian incorpora la 6.2.x.
cd /usr/local/src
wget -c ftp://ftp.fu-berlin.de/unix/X11/graphics/ImageMagick/ImageMagick-6.4.1-10.tar.gz
tar zxvfp ImageMagick-6.4.1-10.tar.gz
You can’t perform that action at this time.