Changeset 16306


Ignore:
Timestamp:
Jul 15, 2016, 2:03:10 PM (3 years ago)
Author:
dferreira
Message:

Image Analyser API with Illustration 2 Vector ready.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • internals/2016/aptoideimagesdetector/trunk/Source Code/Illustration2Vector/illustration2vec-master/analyse_image.py

    r16305 r16306  
    55import sys
    66
    7 # Still not done neither tested...
    87
    98def analyse_explicit(illust2vec, image_dir):
    10        
    119
    12     img = Image.open(os.path.join(dir))
    13     list = illust2vec.estimate_specific_tags([img], ["explicit", "safe"])
    14     print image_dir
     10        img = Image.open(os.path.join(image_dir))
    1511
    16         if(list[0]['explicit']>list[0]['safe']):
     12        list = illust2vec.estimate_specific_tags([img], ["explicit", "safe"])
     13   
     14        if list[0]['explicit']>list[0]['safe']:
    1715                print "explicit"
    1816        else:
     
    2119if __name__ == "__main__":
    2220       
    23         print "Loading tags..."
    24        
     21        print "Loading Neural Network Model..."
    2522        illust2vec = i2v.make_i2v_with_chainer(
    2623    "illust2vec_tag_ver200.caffemodel", "tag_list.json")
    2724
    2825        for image_dir in sys.argv:
    29                 print "Analysing image..."
    30                 analyse_explicit(illust2vec, image_dir)
     26                if image_dir!=sys.argv[0]:
     27                        print "Analysing image..."
     28                        analyse_explicit(illust2vec, image_dir)
Note: See TracChangeset for help on using the changeset viewer.