source: internals/2016/aptoideimagesdetector/trunk/Source Code/Illustration2Vector/illustration2vec-master/analyse_image.py @ 16301

Last change on this file since 16301 was 16301, checked in by dferreira, 3 years ago

Added initial for testing Illustration 2 Vector.

File size: 659 bytes
Line 
1import i2v
2from datetime import datetime, time
3from PIL import Image
4import os
5import glob
6import sys
7
8# Still not done neither tested...
9
10def analyse_explicit(illust2vec, image_dir):
11       
12
13    img = Image.open(os.path.join(dir))
14    list = illust2vec.estimate_specific_tags([img], ["explicit", "safe"])
15    print image_dir
16
17        if(list[0]['explicit']>list[0]['safe']):
18                print "explicit"
19        else:
20                print "safe"
21
22if __name__ == "__main__":
23       
24        print "Loading tags..."
25       
26        illust2vec = i2v.make_i2v_with_chainer(
27    "illust2vec_tag_ver200.caffemodel", "tag_list.json")
28
29        for image_dir in sys.argv:
30                print "Analysing image..."
31                analyse_explicit(illust2vec, image_dir)
Note: See TracBrowser for help on using the repository browser.