Permalink
Browse files

Merge pull request #22 from mangaki/master

Port to Python 3
  • Loading branch information...
rezoo committed Dec 14, 2018
2 parents 7498b29 + f4d2e60 commit 00dd6d19a6efed8843bba297f336f7cfe34465cf
Showing with 14 additions and 9 deletions.
  1. +8 −8 i2v/base.py
  2. +1 −1 i2v/chainer_i2v.py
  3. +5 −0 requirements.txt
@@ -61,18 +61,18 @@ def estimate_top_tags(self, images, n_tag=10):
result = []
for i in range(prob.shape[0]):
result.append({
'general': zip(
'general': list(zip(
self.tags[general_arg[i]],
general_prob[i, general_arg[i]].tolist()),
'character': zip(
general_prob[i, general_arg[i]].tolist())),
'character': list(zip(
self.tags[512 + character_arg[i]],
character_prob[i, character_arg[i]].tolist()),
'copyright': zip(
character_prob[i, character_arg[i]].tolist())),
'copyright': list(zip(
self.tags[1024 + copyright_arg[i]],
copyright_prob[i, copyright_arg[i]].tolist()),
'rating': zip(
copyright_prob[i, copyright_arg[i]].tolist())),
'rating': list(zip(
self.tags[1536 + rating_arg[i]],
rating_prob[i, rating_arg[i]].tolist()),
rating_prob[i, rating_arg[i]].tolist())),
})
return result

@@ -25,7 +25,7 @@ def resize_image(self, im, new_dims, interp_order=1):
# skimage is fast but only understands {1,3} channel images
# in [0, 1].
im_std = (im - im_min) / (im_max - im_min)
resized_std = resize(im_std, new_dims, order=interp_order)
resized_std = resize(im_std, new_dims, order=interp_order, mode='constant')
resized_im = resized_std * (im_max - im_min) + im_min
else:
# the image is a constant -- avoid divide by 0
@@ -0,0 +1,5 @@
numpy
scipy
Pillow
scikit-image
chainer>=2.0.0

0 comments on commit 00dd6d1

Please sign in to comment.