Recognize Godzilla
by
Recoginize Godzilla
DEMO
:
: HTML CSS
: B
(´ ω )
Recognize Godzilla
1954 29
https://ja.wikipedia.org/wiki/
:
http://www.asahi.com/articles/ASJ8X42B7J8XPUTB
001.html
INPUT
Not OUTPUT
T
LT
OpenCV
GE○ TUTAY○ Mac
Hulu
(´ )
1,000 / ( )
Selenium
SeleniumHQ
Selenium Python
URL
1
Ubuntu
Flash
(´ ω )
Google Chrome, Firefox
=> Mac Pro
Python => Selenium Firefox
=> (´ ω )
Firefox 48 selenium-webdriver
=> Firefox 47.x
=> 5GB
=>
4 180GB^^;
=> 31
=> HDD
1 => 4
(´ ω )
Python
Python web driver
API
Python Selenium
Plugin JavaScript
Selenium
Plugin
1. html canvas
2.
(^o^)
screencapture
Cmd+Shift+4“
“
Python OSS
pyscreencapture
python Selenium
screencapture
(´ )
32px x 32px
1.
2.
1x25, 2x4, 3x1, 4x1, 5x1
1 = 192px
x 192px
3. 32px x 32px
( 6 shift orz)
trimming.py
def trimming(image_path):
#
x = 334
y = 276
#
width = 1892
height = 1066
src = cv2.imread(image_path, 1)
dst = src[y:y + height, x:x + width]
file_name = re.sub('(godzilla[0-9]+.jpg)',
'trimming_1',
image_path)
cv2.imwrite(file_name, dst)
cutout.py
def cutout_square(img, image_path,
full_path, pixel_size, loop_count,
x_start_point, y_start_point, image_prefix):
for x in range(loop_count):
for y in range(loop_count):
x_start = x_start_point + (pixel_size * x)
x_end = x_start + pixel_size
y_start = y_start_point + (pixel_size * y)
y_end = y_start + pixel_size
dist = img[y_start:y_end, x_start:x_end]
resize_image = resize.to_target_pixel(dist)
if type(resize_image).__module__ == 
np.__name__:
write_image(resize_image,
image_prefix,
full_path)
else:
print(image_path)
resize.py
def to_target_pixel(image, pixel_size=32):
height = image.shape[0]
width = image.shape[1]
try:
resize_size_list = (
int(height / (height / pixel_size)),
int(width / (width/ pixel_size)))
return cv2.resize(image, resize_size_list)
except:
return False
(※ github )
ls Finder
=> cp mv too many arguments
=>
=> 5
=> (1 * 25) * (shift ) 5 * ( ) 20,000 ≒
2,500,000
=> ↑
=> (´ ω )
find xargs
$ find ${DIRECTORY} -name ${FIND_PARAM} -maxdepth 1 
-print0 | xargs -0 -J {} mv {} ${MV_DIRECTORY}
${DIRECTORY}
${FIND_PARAM}
${MV_DIRECTORY}
1x25
2x4
1x3, 1x4 shift
1x5
32px x 32px
(´ ω )
=>
=>
=>
3500 2017/03/16
500
=>
(^o^)
3
(´ ω )
※
0:00(20176/03/17)
GO
1000
ω ⊃ !!
facebook
github clone
python
$ python increase_picture.py ${IMAGE_FILE}
find
$ find ${IMG_FILES} -maxdepth 1 -exec 
increase_picture.py {} ;
>>> datasets.shape
(41688, 1, 3072)
>>> labels.shape
(41688, 1)
41,688
(is("INPUT")) ? " " : " "
keras
CIFAR-10
The CIFAR-10 dataset
[1, 3072] numpy
3072
32px * 32px * 3(RGB) = 3072
RGB R G B
[[0, 0]] <-
0
1
cifar-10 10 0 9
2 0 1
keras
# (?)
batch_size = 32
# ! 10 2
nb_classes = 2
# (?)
nb_epoch = 4
# (?)
nb_filter = 10
# input image dimensions. img_rows = height, img_cols = width
img_rows, img_cols = 32, 32
# the CIFAR10 images are RGB
img_channels = 3
model.evaluate(X_test, Y_test)
> [0.6990031684412652, 0.4959700633390145]
°ω°
°ω°
# json
# yaml
json_string = model.to_json()
open(os.path.join('./model/', 'model.json'), 'w').write(json_str
#
model.save_weights(os.path.join('./model/','model_weights.hdf5'
bottle
※
※
DEMO
(´ ω )
etc
Data Set
hulu seleniu
keras OpenCV
Recognize Godzilla

Recognize Godzilla