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
map.data.addListener('click', event => { | |
let name = event.feature.getProperty('name'); | |
let desc = event.feature.getProperty('desc'); | |
let position = event.feature.getGeometry().get(); | |
let content = ` | |
<img style="float:left; width:10px; margin-top:30px"> | |
<div style="margin-left:120px; margin-bottom:20px;"> | |
<h2>${name}</h2> | |
<p>${desc}</p> |
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
function initMap (){ | |
const map = new google.maps.Map(document.querySelector('#map'), { | |
zoom: 14, | |
center: { | |
// TA | |
lat: 32.0705, // N-S | |
lng: 34.7691 // W-E | |
}, |
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
<html> | |
<head> | |
<title>TA Artist Map</title> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
<head> | |
<body> | |
<div id="map" class="map"></div> | |
<script src="map.js"></script> | |
<script async defer |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
#https://gist.github.com/stared/dfb4dfaf6d9a8501cd1cc8b8cb806d2e | |
class PlotLosses(keras.callbacks.Callback): | |
def __init__(self,imgs): | |
super(PlotLosses, self).__init__() | |
self.imgs=imgs | |
def on_train_begin(self, logs={}): | |
self.i = 0 | |
self.x = [] |
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
from keras.models import model_from_json | |
def save_keras_model(model,path): | |
model_json = model.to_json() | |
with open(path+"json", "w") as json_file: | |
json_file.write(model_json) | |
model.save_weights(path+'.hdf5') | |
def load_keras_model(path): |
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
#simple model | |
model = Sequential([ | |
#Embedding(vocab_size, vec_size, input_length=seq_len,weights=[emb]), | |
#Flatten(), | |
Dense(100, input_dim=test_data.shape[1], init='uniform', activation='relu'), | |
#Dropout(0.7), | |
Dense(1, activation='sigmoid')]) | |
model.compile(loss='binary_crossentropy', optimizer=Adam(), metrics=['accuracy']) |
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
from keras.applications.vgg16 import VGG16 | |
from keras.layers import Conv2D | |
from keras.models import Sequential | |
from keras.layers import BatchNormalization | |
from keras.optimizers import Adam | |
vgg=VGG16() | |
p=0.4 #dropout | |
label_count=17 |
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
from keras.applications.resnet50 import ResNet50 | |
from scipy.misc import imresize | |
resnet=ResNet50() | |
imgs_new=[] | |
for i,img in enumerate(imgs_new_rand): | |
imgs_new[i]=imresize(img,(224,224,3)) | |
resnet_preds=resnet.predict(imgs_new) |
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
plt.imshow(np.array(Image.open(g[0]))[y-30:y+30,x-30:x+30]) | |
currentAxis = plt.gca() | |
coords=[10,10],20,20 | |
currentAxis.add_patch(plt.Rectangle(*coords, fill=False, edgecolor=color, linewidth=2)) |
NewerOlder