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

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

Delete tar file.

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