-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample.py
35 lines (29 loc) · 950 Bytes
/
sample.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# coding:utf-8
from tqdm import tqdm
import os
import numpy as np
import chainer
from chainer import cuda, Function, gradient_check, report, training, utils, Variable
from chainer import datasets, iterators, optimizers, serializers
from chainer import Link, Chain, ChainList
import chainer.functions as F
import chainer.links as L
from chainer.training import extensions
from chainer.functions.loss.mean_squared_error import mean_squared_error
from PIL import Image
import glob
distance_min = [10**10, None, None]
distance_max = [0, None, None]
for a in "人": # tqdm(chars[0]):
for b in chars:
if a == b:
continue
x = model.feature(a)
y = model.feature(b)
distance = model.distance(x, y)
if distance > distance_max[0]:
distance_max = [distance, a, b]
if distance < distance_min[0]:
distance_min = [distance, a, b]
print(distance_max)
print(distance_min)