def test_embeddings(): model = Siamese('dummy', input_shape=(6, 8, 3), embedding_size=3) model.make_embeddings('data_tiny/train', 'data_tiny/train.csv', batch_size=1) emb = pd.read_pickle(os.path.join(model.cache_dir, 'embeddings.pkl')) print(emb) model.predict('data_tiny/train') pred = pd.read_pickle(os.path.join(model.cache_dir, 'predictions.pkl')) print(pred)
from core.siamese import Siamese model = Siamese('shallow_mnist', input_shape=(28, 28, 3), embedding_size=64, strategy='batch_all') model.load_weights('cache/cache-190213-131256/training/checkpoint-07.h5') model.make_embeddings('data_mnist/train.csv', 'data_mnist/train', batch_size=200) model.predict('data_mnist/train_subset') model.make_csv('cache/cache-190213-131256/idx_to_whales_mapping.npy') # model.load_embeddings('cache/cache-190205-070856/embeddings.pkl') # model.load_predictions('cache/cache-190205-072026/predictions.pkl') # model.make_kaggle_csv('cache/cache-190205-065005/idx_to_whales_mapping.npy') # model.draw_tsne(model.predictions.values[:, 1:])
from core.siamese import Siamese model = Siamese('mobilenet_like', input_shape=(672, 896, 3), embedding_size=128) model.load_weights('trained/final_weights.h5') #model.make_embeddings('data/train', 'data/train.csv', batch_size=5, meta_dir='data/meta') model.load_embeddings('trained/embeddings.pkl') model.predict('data/test', meta_dir='data/meta') #model.load_predictions('trained/predictions.pkl') model.make_kaggle_csv('data/meta/idx_to_whales_mapping.npy')
from core.siamese import Siamese model = Siamese('mobilenet_like', input_shape=(672, 896, 3), embedding_size=128, strategy='batch_hard') model.load_weights('cache/cache-190213-095205/training/checkpoint-07.h5') model.load_embeddings('cache/cache-190213-113426/embeddings.pkl') # model.make_embeddings('data/train.csv', 'data/train', batch_size=32) # model.predict('data/test') model.predict('data/train_subset') model.make_csv('cache/cache-190208-093118/idx_to_whales_mapping.npy')
import sys sys.path.insert(0, '../') from core.siamese import Siamese model = Siamese('mobilenet_like', input_shape=(672, 896, 3), embedding_size=128) model.load_weights('trained/final_weights.h5') model.make_embeddings('../data/train', 'train.csv', mappings_filename='../data/meta/whales_to_idx_mapping.npy', batch_size=25) #model.load_embeddings('trained/embeddings.pkl') model.predict('../data/train', 'val.csv') #model.predict('../data/train', 'train.csv')