Ignore:
Timestamp:
Jul 18, 2016, 10:35:15 AM (3 years ago)
Author:
dferreira
Message:

Otimizing scripts using object serialization.

File:
1 edited

Legend:

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

    r16306 r16326  
     1# Diogo Ferreira
     2# Aptoide, 2016
     3# This script analyses a list of images, printing the output safe/explicit.
     4# As argument passed in the command line sould be the name of all files wanted to analyse.
     5# For example, python analyse_image.py aptoide_images/nude/1.jpg
     6
     7
    18import i2v
    29from PIL import Image
     
    411import glob
    512import sys
     13import pickle
    614
    715
     
    2028       
    2129        print "Loading Neural Network Model..."
    22         illust2vec = i2v.make_i2v_with_chainer(
    23     "illust2vec_tag_ver200.caffemodel", "tag_list.json")
     30        try:
     31                illust2vec_f = open("illust2vec.pickle", "rb")
     32                illust2vec = pickle.load(illust2vec_f)
     33                illust2vec_f.close()
     34        except IOError:
     35                illust2vec = i2v.make_i2v_with_chainer(
     36            "illust2vec_tag_ver200.caffemodel", "tag_list.json")
     37                save_model = open("illust2vec.pickle", "wb")
     38                pickle.dump(illust2vec, save_model)
     39                save_model.close()
     40
    2441
    2542        for image_dir in sys.argv:
Note: See TracChangeset for help on using the changeset viewer.