cjekel / tindetheus

Build personalized machine learning models for Tinder using Python
MIT License
87 stars 20 forks source link

ValueError: Could not find a format.....while running tindetheus train #53

Open zokim78 opened 3 years ago

zokim78 commented 3 years ago

I managed to have it finish a smaller session earlier but now with 3000+ images I'm getting these errors. Looks like there are a few things not working and I'm not sure if its my build.

(tinder_ai) bash-3.2$ tindetheus train /Users/zmilosevic/.local/share/virtualenvs/tinder_ai-x3LwT0UQ/lib/python3.7/site-packages/pandas/compat/init.py:97: UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError. warnings.warn(msg) Creating networks and loading parameters WARNING:tensorflow:From /Users/zmilosevic/tinder_ai/tindetheus/tindetheus/tindetheus_align.py:86: The name tf.GPUOptions is deprecated. Please use tf.compat.v1.GPUOptions instead.

WARNING:tensorflow:From /Users/zmilosevic/tinder_ai/tindetheus/tindetheus/tindetheus_align.py:87: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

WARNING:tensorflow:From /Users/zmilosevic/tinder_ai/tindetheus/tindetheus/tindetheus_align.py:87: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

2021-01-14 16:19:06.948437: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 2021-01-14 16:19:07.006258: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7f879c680f50 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2021-01-14 16:19:07.006290: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version WARNING:tensorflow:From /Users/zmilosevic/tinder_ai/tindetheus/tindetheus/facenet_clone/align/detect_face.py:280: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead.

WARNING:tensorflow:From /Users/zmilosevic/tinder_ai/tindetheus/tindetheus/facenet_clone/align/detect_face.py:281: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

WARNING:tensorflow:From /Users/zmilosevic/tinder_ai/tindetheus/tindetheus/facenet_clone/align/detect_face.py:125: The name tf.get_variable is deprecated. Please use tf.compat.v1.get_variable instead.

WARNING:tensorflow:From /Users/zmilosevic/tinder_ai/tindetheus/tindetheus/facenet_clone/align/detect_face.py:177: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.

WARNING:tensorflow:From /Users/zmilosevic/tinder_ai/tindetheus/tindetheus/facenet_clone/align/detect_face.py:213: div (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version. Instructions for updating: Deprecated in favor of operator or tf.math.divide. WARNING:tensorflow:From /Users/zmilosevic/tinder_ai/tindetheus/tindetheus/facenet_clone/align/detect_face.py:197: The name tf.nn.xw_plus_b is deprecated. Please use tf.compat.v1.nn.xw_plus_b instead.

database/dislike/5c4244880cb7e911009b2a4b.0.jpg database/dislike/532272d7205ff5a8390035f9.3.jpg database/dislike/5fbb83d1cf613b010028b312.1.jpg

Goes through the images...

Total number of images: 3943 Number of successfully aligned images: 0 Model directory: /Users/zmilosevic/tinder_ai/models/20170512-110547 Metagraph file: model-20170512-110547.meta Checkpoint file: model-20170512-110547.ckpt-250000 WARNING:tensorflow:From /Users/zmilosevic/tinder_ai/tindetheus/tindetheus/facenet_clone/facenet.py:381: The name tf.train.import_meta_graph is deprecated. Please use tf.compat.v1.train.import_meta_graph instead.

WARNING:tensorflow:The saved meta_graph is possibly from an older release: 'model_variables' collection should be of type 'byte_list', but instead is of type 'node_list'. WARNING:tensorflow:From /Users/zmilosevic/.local/share/virtualenvs/tinder_ai-x3LwT0UQ/lib/python3.7/site-packages/tensorflow_core/python/training/queue_runner_impl.py:391: QueueRunner.init (from tensorflow.python.training.queue_runner_impl) is deprecated and will be removed in a future version. Instructions for updating: To construct input pipelines, use the tf.data module. WARNING:tensorflow:From /Users/zmilosevic/tinder_ai/tindetheus/tindetheus/facenet_clone/facenet.py:382: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead.

WARNING:tensorflow:From /Users/zmilosevic/tinder_ai/tindetheus/tindetheus/export_embeddings.py:117: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.

Number of images: 3533 Number of batches: 4 Completed batch 1 of 4 Completed batch 2 of 4 Traceback (most recent call last): File "/Users/zmilosevic/.local/share/virtualenvs/tinder_ai-x3LwT0UQ/bin/tindetheus", line 33, in sys.exit(load_entry_point('tindetheus', 'console_scripts', 'tindetheus')()) File "/Users/zmilosevic/tinder_ai/tindetheus/tindetheus/tindetheus.py", line 279, in command_line_run retries=defaults['retries']) File "/Users/zmilosevic/tinder_ai/tindetheus/tindetheus/tindetheus.py", line 89, in main image_batch=args.image_batch) File "/Users/zmilosevic/tinder_ai/tindetheus/tindetheus/export_embeddings.py", line 142, in main False, False, image_size) File "/Users/zmilosevic/tinder_ai/tindetheus/tindetheus/facenet_clone/facenet.py", line 247, in load_data img = imageio.imread(image_paths[i]) File "/Users/zmilosevic/.local/share/virtualenvs/tinder_ai-x3LwT0UQ/lib/python3.7/site-packages/imageio/core/functions.py", line 265, in imread reader = read(uri, format, "i", **kwargs) File "/Users/zmilosevic/.local/share/virtualenvs/tinder_ai-x3LwT0UQ/lib/python3.7/site-packages/imageio/core/functions.py", line 182, in get_reader "Could not find a format to read the specified file in %s mode" % modename ValueError: Could not find a format to read the specified file in single-image mode (tinder_ai) bash-3.2$

cjekel commented 3 years ago

It looks like your build is working just fine.

I think what's happening is that you some phantom profile image that is messing things up. Best to delete those images, or move those images out of your database.

You can write a quick script to check which images do not load.

import glob
import imageio

images_dislike = glob.glob('database/dislike/*')
images_like = glob.glob('database/like/*')
images = images_dislike + images_like
for image in images:
    try:
         _ = imageio.imread(image)
    except ValueError:
        print("Could not load:", image)

Just move those bad images to another folder, it should only be a couple.