
# -*- coding: utf-8 -*-
"""Tsne.ipynb
Automatically generated by Colaboratory.
Original file is located at
    https://colab.research.google.com/drive/11iqaTgnE4Hcxo0BYwALq2io9TFaSTxfO
"""

import os

import pdb
import numpy as np
from scipy import io
# !pip install MulticoreTSNE
from MulticoreTSNE import MulticoreTSNE as TSNE
from matplotlib import pyplot as plt
import matplotlib
import seaborn as sns
import time


mask_feat_path = "/home/dipesh/Desktop/age-gender/npy_feats/masked_feat_1629x1280.npy"
non_mask_feat_path = "/home/dipesh/Desktop/age-gender/npy_feats/non_masked_feat_1994x1280.npy"

mask_feat = np.load(mask_feat_path)
non_mask_feat = np.load(non_mask_feat_path)

print("mask feature shape {}".format(mask_feat.shape))
print("non_mask feature shape {}".format(non_mask_feat.shape))

all_features = np.concatenate((mask_feat, non_mask_feat), axis = 0)
dataset_label = np.zeros((all_features.shape[0],1))
dataset_label[mask_feat.shape[0]:] = 1

start_time = time.time()

tsne = TSNE(n_jobs=16)

embeddings = tsne.fit_transform(all_features)
vis_x = embeddings[:, 0]
vis_y = embeddings[:, 1]
sns.set(rc={'figure.figsize':(11.7,8.27)})
palette = sns.color_palette("bright", 2)

plot = sns.scatterplot(vis_x, vis_y, hue=dataset_label[:,0], legend='full', palette=palette)
plt.savefig("mask_non-mask_tsne.png")
print("--- {} mins {} secs---".format((time.time() - start_time)//60,(time.time() - start_time)%60))
d99e8a0b98f6a51651aa4d48cfdd80fad731fc97
<mask token>

<mask token>
print('mask feature shape {}'.format(mask_feat.shape))
print('non_mask feature shape {}'.format(non_mask_feat.shape))
<mask token>
sns.set(rc={'figure.figsize': (11.7, 8.27)})
<mask token>
plt.savefig('mask_non-mask_tsne.png')
print('--- {} mins {} secs---'.format((time.time() - start_time) // 60, (
    time.time() - start_time) % 60))

<mask token>
mask_feat_path = (
    '/home/dipesh/Desktop/age-gender/npy_feats/masked_feat_1629x1280.npy')
non_mask_feat_path = (
    '/home/dipesh/Desktop/age-gender/npy_feats/non_masked_feat_1994x1280.npy')
mask_feat = np.load(mask_feat_path)
non_mask_feat = np.load(non_mask_feat_path)
print('mask feature shape {}'.format(mask_feat.shape))
print('non_mask feature shape {}'.format(non_mask_feat.shape))
all_features = np.concatenate((mask_feat, non_mask_feat), axis=0)
dataset_label = np.zeros((all_features.shape[0], 1))
dataset_label[mask_feat.shape[0]:] = 1
start_time = time.time()
tsne = TSNE(n_jobs=16)
embeddings = tsne.fit_transform(all_features)
vis_x = embeddings[:, 0]
vis_y = embeddings[:, 1]
sns.set(rc={'figure.figsize': (11.7, 8.27)})
palette = sns.color_palette('bright', 2)
plot = sns.scatterplot(vis_x, vis_y, hue=dataset_label[:, 0], legend='full',
    palette=palette)
plt.savefig('mask_non-mask_tsne.png')
print('--- {} mins {} secs---'.format((time.time() - start_time) // 60, (
    time.time() - start_time) % 60))

<mask token>
import os
import pdb
import numpy as np
from scipy import io
from MulticoreTSNE import MulticoreTSNE as TSNE
from matplotlib import pyplot as plt
import matplotlib
import seaborn as sns
import time
mask_feat_path = (
    '/home/dipesh/Desktop/age-gender/npy_feats/masked_feat_1629x1280.npy')
non_mask_feat_path = (
    '/home/dipesh/Desktop/age-gender/npy_feats/non_masked_feat_1994x1280.npy')
mask_feat = np.load(mask_feat_path)
non_mask_feat = np.load(non_mask_feat_path)
print('mask feature shape {}'.format(mask_feat.shape))
print('non_mask feature shape {}'.format(non_mask_feat.shape))
all_features = np.concatenate((mask_feat, non_mask_feat), axis=0)
dataset_label = np.zeros((all_features.shape[0], 1))
dataset_label[mask_feat.shape[0]:] = 1
start_time = time.time()
tsne = TSNE(n_jobs=16)
embeddings = tsne.fit_transform(all_features)
vis_x = embeddings[:, 0]
vis_y = embeddings[:, 1]
sns.set(rc={'figure.figsize': (11.7, 8.27)})
palette = sns.color_palette('bright', 2)
plot = sns.scatterplot(vis_x, vis_y, hue=dataset_label[:, 0], legend='full',
    palette=palette)
plt.savefig('mask_non-mask_tsne.png')
print('--- {} mins {} secs---'.format((time.time() - start_time) // 60, (
    time.time() - start_time) % 60))


# -*- coding: utf-8 -*-
"""Tsne.ipynb
Automatically generated by Colaboratory.
Original file is located at
    https://colab.research.google.com/drive/11iqaTgnE4Hcxo0BYwALq2io9TFaSTxfO
"""

import os

import pdb
import numpy as np
from scipy import io
# !pip install MulticoreTSNE
from MulticoreTSNE import MulticoreTSNE as TSNE
from matplotlib import pyplot as plt
import matplotlib
import seaborn as sns
import time


mask_feat_path = "/home/dipesh/Desktop/age-gender/npy_feats/masked_feat_1629x1280.npy"
non_mask_feat_path = "/home/dipesh/Desktop/age-gender/npy_feats/non_masked_feat_1994x1280.npy"

mask_feat = np.load(mask_feat_path)
non_mask_feat = np.load(non_mask_feat_path)

print("mask feature shape {}".format(mask_feat.shape))
print("non_mask feature shape {}".format(non_mask_feat.shape))

all_features = np.concatenate((mask_feat, non_mask_feat), axis = 0)
dataset_label = np.zeros((all_features.shape[0],1))
dataset_label[mask_feat.shape[0]:] = 1

start_time = time.time()

tsne = TSNE(n_jobs=16)

embeddings = tsne.fit_transform(all_features)
vis_x = embeddings[:, 0]
vis_y = embeddings[:, 1]
sns.set(rc={'figure.figsize':(11.7,8.27)})
palette = sns.color_palette("bright", 2)

plot = sns.scatterplot(vis_x, vis_y, hue=dataset_label[:,0], legend='full', palette=palette)
plt.savefig("mask_non-mask_tsne.png")
print("--- {} mins {} secs---".format((time.time() - start_time)//60,(time.time() - start_time)%60))