Ejemplo n.º 1
0
 def auto_like(self):
     while True:
         sleep(10)
         try:
             rawURL = self.get_image_path()
             image_url = self.get_url(rawURL)
             print(image_url)
             user['photos'].append(image_url)
             print(user['photos'])
             person1 = person.Person(user)
             detection_graph = person_detector.open_graph()
             with detection_graph.as_default():
                 with tf.Session() as sess:
                     classifier = Classifier(
                         graph="./tf/training_output/retrained_graph.pb",
                         labels="./tf/training_output/retrained_labels.txt")
                     score = person1.predict_likeliness(classifier, sess)
                     print(score)
                     if (score[0] <= 0.6):
                         self.dislike()
                         print("Nope")
                     else:
                         self.like()
                         print("YES")
             user['photos'].pop()
         except Exception:
             try:
                 self.close_pop_up()
             except Exception:
                 try:
                     self.match_pop_up()
                 except Exception:
                     try:
                         self.window_pop_up()
                     except Exception:
                         # self.out_of_like_pop_up()
                         break
Ejemplo n.º 2
0
import person_detector
import tensorflow as tf

command = """
python retrain.py --bottleneck_dir=tf/training_data/bottlenecks --model_dir=tf/training_data/inception --summaries_dir=tf/training_data/summaries/basic --output_graph=tf/training_output/retrained_graph.pb --output_labels=tf/training_output/retrained_labels.txt --image_dir=./images/classified --how_many_training_steps=50000 --testing_percentage=20 --learning_rate=0.001
"""

IMAGE_FOLDER = "./images/unclassified"
POS_FOLDER = "./images/classified/positive"
NEG_FOLDER = "./images/classified/negative"
LOVOO_FOLDER = "./images/lovoo"



if __name__ == "__main__":
    detection_graph = person_detector.open_graph()

    images = [f for f in os.listdir(IMAGE_FOLDER) if os.path.isfile(os.path.join(IMAGE_FOLDER, f))]
    positive_images = filter(lambda image: (image.startswith("1_")), images)
    negative_images = filter(lambda image: (image.startswith("0_")), images)
    lovoo_images = [f for f in os.listdir(LOVOO_FOLDER) if os.path.isfile(os.path.join(LOVOO_FOLDER, f))]

    with detection_graph.as_default():
        with tf.Session() as sess:

            for pos in lovoo_images:
                old_filename = LOVOO_FOLDER + "/" + pos
                new_filename = POS_FOLDER + "/" + pos[:-5] + ".jpg"

                if not os.path.isfile(new_filename):
                    print(">> Moving positive image: " + pos)