mikeyEcology / MLWIC2

Classify camera trap images using machine learning with R Shiny Apps
36 stars 17 forks source link

The classify function did not run properly #24

Open Nova-Scotia opened 3 years ago

Nova-Scotia commented 3 years ago

Hi Mikey,

Posting this here in case it helps anyone else. I previously had MLWIC2 working as expected on my Windows computer, but after a crash and rebuild of my user profile, I've had to start from scratch. I reinstalled Anaconda3 5.2.0 and python 3.6 on my machine. I installed tensorflow 1.14 and tried to install cudnn v 6.0 as specified in my original MLWIC_examples tutorial, but it's no longer available, so I installed V 7.6.0.

I got setup to run successfully, but when I try to run classify on your example folder, I get error messages about classify not running properly. Anything I can do to fix? Note the code says I'm not using a Windows computer... but I am... should this be a red flag?

Using R V. 4.0.2. I also tried running classify with cudnn V 7.3 but no love.

classify(path_prefix = "D:/CameraTrap/MLWIC2_Test/MLWIC_examples/images", 
          data_info = "D:/CameraTrap/MLWIC2_Test/MLWIC_examples/image_labels.csv", 
          model_dir = "D:/CameraTrap/MLWIC2_Test/MLWIC2_helper_files", 
          python_loc = "C:/Users/NewtonEr/Anaconda", 
         save_predictions = "model_predictions_feb21.txt", 
          make_output = TRUE, 
          output_name = "MLWIC2_output_feb21.csv", 
          num_cores = 4 ) 
Your `data_info` file exists: D:/CameraTrap/MLWIC2_Test/MLWIC_examples/image_labels.csv.
Your `path_prefix exists: D:/CameraTrap/MLWIC2_Test/MLWIC_examples/images.
You are not using a Windows computer.
WARNING:tensorflow:From run.py:338: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

WARNING:tensorflow:From run.py:338: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

2021-02-04 11:34:38.677730: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
WARNING:tensorflow:From run.py:192: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

WARNING:tensorflow:From run.py:203: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead.

WARNING:tensorflow:From D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\data_loader.py:140: slice_input_producer (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by `tf.data`. Use `tf.data.Dataset.from_tensor_slices(tuple(tensor_list)).shuffle(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs)`. If `shuffle=False`, omit the `.shuffle(...)`.
WARNING:tensorflow:From C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\input.py:374: range_input_producer (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by `tf.data`. Use `tf.data.Dataset.range(limit).shuffle(limit).repeat(num_epochs)`. If `shuffle=False`, omit the `.shuffle(...)`.
WARNING:tensorflow:From C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\input.py:320: input_producer (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by `tf.data`. Use `tf.data.Dataset.from_tensor_slices(input_tensor).shuffle(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs)`. If `shuffle=False`, omit the `.shuffle(...)`.
WARNING:tensorflow:From C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\input.py:190: limit_epochs (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by `tf.data`. Use `tf.data.Dataset.from_tensors(tensor).repeat(num_epochs)`.
WARNING:tensorflow:From C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\input.py:199: 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 C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\input.py:199: add_queue_runner (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 D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\data_loader.py:100: The name tf.read_file is deprecated. Please use tf.io.read_file instead.

WARNING:tensorflow:From D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\data_loader.py:102: to_float (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.cast` instead.
WARNING:tensorflow:From D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\data_loader.py:104: The name tf.image.resize_images is deprecated. Please use tf.image.resize instead.

WARNING:tensorflow:From D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\data_loader.py:222: The name tf.image.resize_image_with_crop_or_pad is deprecated. Please use tf.image.resize_with_crop_or_pad instead.

WARNING:tensorflow:From C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\ops\image_ops_impl.py:1514: 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.
Namespace(LR_details='19, 30, 44, 53, 0.01, 0.005, 0.001, 0.0005, 0.0001', LR_policy='piecewise_linear', WD_details='30, 0.0005, 0.0', WD_policy='piecewise_linear', architecture='resnet', batch_size=128, chunked_batch_size=64, command='eval', delimiter=',', depth=18, log_debug_info=False, log_device_placement=False, log_dir='species_model', max_to_keep=5, num_batches=-1, num_classes=1000, num_epochs=55, num_gpus=2, num_prefetch=2000, num_threads=4, optimizer='momentum', path_prefix='D:/CameraTrap/MLWIC2_Test/MLWIC_examples/images', processed_size=[224, 224, 3], raw_size=[256, 256, 3], retrain_from=None, run_metadata=None, run_name='Run-04-02-2021_11-34-38', run_options=None, save_predictions='D:/CameraTrap/MLWIC2_Test/MLWIC2_helper_files/model_predictions_feb21.txt', shuffle=True, snapshot_prefix='species_model', top_n=5, train_info=None, transfer_mode=[0], val_info='D:/CameraTrap/MLWIC2_Test/MLWIC_examples/image_labels.csv')
found 15 classes
{1: 1, 11: 11, 13: 13, 14: 14, 15: 15, 20: 20, 21: 21, 22: 22, 23: 23, 24: 24, 25: 25, 27: 27, 3: 3, 4: 4, 8: 8}
Filling queue with 2000 images before starting to train. This may take some time.
The classify function did not run properly.
mikeyEcology commented 3 years ago

None of those warnings look like a problem, although I'm not sure why they are being printed to the console. It's saying that you are not on windows because you didn't set os="Windows", but this shouldn't cause any problems anymore either. Are you running on a GPU (did you install tensorflow-gpu)? What happens if you set batch_size = 16 in your classify call?

Those error messages might be from an incorrect version of tensorflow. It can spontaneously change versions on Windows! If you go into the Anaconda prompt (can be found by clicking on the four square in the bottom right hand corner of your computer and searching for it) and type conda activate r-reticulate, then type python, then type import tensorflow as tf Then type tf.__version__ (two underscores on each side of version).

Nova-Scotia commented 3 years ago

Hi Mikey,

Looks like tensorflow is indeed 1.14.0 when I check it using Anaconda Prompt. I didn't install tensorflow-gpu - should I?

I set the batch size to 16 - here's the messages:

classify(path_prefix = "D:/CameraTrap/MLWIC2_Test/MLWIC_examples/images", 
         data_info = "D:/CameraTrap/MLWIC2_Test/MLWIC_examples/image_labels.csv", 
         model_dir = "D:/CameraTrap/MLWIC2_Test/MLWIC2_helper_files", 
         python_loc = "C:/Users/NewtonEr/Anaconda",
         os = "Windows",
         save_predictions = "model_predictions_feb21.txt", 
         make_output = TRUE, 
         batch_size = 16,
         output_name = "MLWIC2_output_feb21.csv", 
         num_cores = 4 
) 

Your `data_info` file exists: D:/CameraTrap/MLWIC2_Test/MLWIC_examples/image_labels.csv.
Your `path_prefix exists: D:/CameraTrap/MLWIC2_Test/MLWIC_examples/images.
You are running on a Windows computer.
WARNING:tensorflow:From run.py:338: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

WARNING:tensorflow:From run.py:338: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

2021-02-05 11:49:18.428982: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
WARNING:tensorflow:From run.py:192: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

WARNING:tensorflow:From run.py:203: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead.

WARNING:tensorflow:From D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\data_loader.py:140: slice_input_producer (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by `tf.data`. Use `tf.data.Dataset.from_tensor_slices(tuple(tensor_list)).shuffle(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs)`. If `shuffle=False`, omit the `.shuffle(...)`.
WARNING:tensorflow:From C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\input.py:374: range_input_producer (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by `tf.data`. Use `tf.data.Dataset.range(limit).shuffle(limit).repeat(num_epochs)`. If `shuffle=False`, omit the `.shuffle(...)`.
WARNING:tensorflow:From C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\input.py:320: input_producer (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by `tf.data`. Use `tf.data.Dataset.from_tensor_slices(input_tensor).shuffle(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs)`. If `shuffle=False`, omit the `.shuffle(...)`.
WARNING:tensorflow:From C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\input.py:190: limit_epochs (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by `tf.data`. Use `tf.data.Dataset.from_tensors(tensor).repeat(num_epochs)`.
WARNING:tensorflow:From C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\input.py:199: 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 C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\input.py:199: add_queue_runner (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 D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\data_loader.py:100: The name tf.read_file is deprecated. Please use tf.io.read_file instead.

WARNING:tensorflow:From D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\data_loader.py:102: to_float (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.cast` instead.
WARNING:tensorflow:From D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\data_loader.py:104: The name tf.image.resize_images is deprecated. Please use tf.image.resize instead.

WARNING:tensorflow:From D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\data_loader.py:222: The name tf.image.resize_image_with_crop_or_pad is deprecated. Please use tf.image.resize_with_crop_or_pad instead.

WARNING:tensorflow:From C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\ops\image_ops_impl.py:1514: 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.
Namespace(LR_details='19, 30, 44, 53, 0.01, 0.005, 0.001, 0.0005, 0.0001', LR_policy='piecewise_linear', WD_details='30, 0.0005, 0.0', WD_policy='piecewise_linear', architecture='resnet', batch_size=16, chunked_batch_size=8, command='eval', delimiter=',', depth=18, log_debug_info=False, log_device_placement=False, log_dir='species_model', max_to_keep=5, num_batches=-1, num_classes=1000, num_epochs=55, num_gpus=2, num_prefetch=2000, num_threads=4, optimizer='momentum', path_prefix='D:/CameraTrap/MLWIC2_Test/MLWIC_examples/images', processed_size=[224, 224, 3], raw_size=[256, 256, 3], retrain_from=None, run_metadata=None, run_name='Run-05-02-2021_11-49-18', run_options=None, save_predictions='D:/CameraTrap/MLWIC2_Test/MLWIC2_helper_files/model_predictions_feb21.txt', shuffle=True, snapshot_prefix='species_model', top_n=5, train_info=None, transfer_mode=[0], val_info='D:/CameraTrap/MLWIC2_Test/MLWIC_examples/image_labels.csv')
found 15 classes
{1: 1, 11: 11, 13: 13, 14: 14, 15: 15, 20: 20, 21: 21, 22: 22, 23: 23, 24: 24, 25: 25, 27: 27, 3: 3, 4: 4, 8: 8}
Filling queue with 2000 images before starting to train. This may take some time.
The classify function did not run properly.
Nova-Scotia commented 3 years ago

Not sure if this helps, but when I try to run it on my own images, I get different messages (below).

I just reinstalled MLWIC on my computer, and I can run classify no problem with it! I'm not sure whether to be happy or sad about that... lol

classify(path_prefix = 'D:/gif_example/small_square_pics',
          data_info = 'D:/gif_example/data_info.csv',
          model_dir = 'D:/CameraTrap/MLWIC2_Test/MLWIC2_helper_files',
         os = "Windows",
          python_loc = 'C:/Users/NewtonEr/Anaconda',
          log_dir = 'species_model', num_classes = 59, save_predictions = 'model_predictions_make_gif_Jan2020.txt', architecture = 'resnet', depth = 18, top_n = 5, batch_size = 128, output_name = 'MLWIC2_output_make_gif_Jan2020.csv')

Your `data_info` file exists: D:/gif_example/data_info.csv.
Your `path_prefix exists: D:/gif_example/small_square_pics.
You are running on a Windows computer.
WARNING:tensorflow:From run.py:338: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

WARNING:tensorflow:From run.py:338: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

2021-02-05 11:53:11.858433: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
WARNING:tensorflow:From run.py:192: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

WARNING:tensorflow:From run.py:203: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead.

Namespace(LR_details='19, 30, 44, 53, 0.01, 0.005, 0.001, 0.0005, 0.0001', LR_policy='piecewise_linear', WD_details='30, 0.0005, 0.0', WD_policy='piecewise_linear', architecture='resnet', batch_size=128, chunked_batch_size=64, command='eval', delimiter=',', depth=18, log_debug_info=False, log_device_placement=False, log_dir='species_model', max_to_keep=5, num_batches=-1, num_classes=59, num_epochs=55, num_gpus=2, num_prefetch=2000, num_threads=1, optimizer='momentum', path_prefix='D:/gif_example/small_square_pics', processed_size=[224, 224, 3], raw_size=[256, 256, 3], retrain_from=None, run_metadata=None, run_name='Run-05-02-2021_11-53-11', run_options=None, save_predictions='D:/CameraTrap/MLWIC2_Test/MLWIC2_helper_files/model_predictions_make_gif_Jan2020.txt', shuffle=True, snapshot_prefix='species_model', top_n=5, train_info=None, transfer_mode=[0], val_info='D:/gif_example/data_info.csv')
Traceback (most recent call last):
  File "run.py", line 397, in <module>
    main()
  File "run.py", line 381, in main
    do_evaluate(sess, args)
  File "run.py", line 211, in do_evaluate
    val_images, val_labels, val_info = val_loader.load()
  File "D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\data_loader.py", line 132, in load
    filepaths, labels = self._read_label_file()
  File "D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\data_loader.py", line 67, in _read_label_file
    labels.append(tokens[1].rstrip().lower())
IndexError: list index out of range
The classify function did not run properly.
mikeyEcology commented 3 years ago

Here are a couple of things to try: 1) Can you put your images on the local drive instead of an external hard drive? Sometimes windows has issues with this 2) Set num_classes=1000 3) In the MLWIC2_helper_files folder, open the run.py file and go to line 18, comment out (with #) those three lines that are suppressing warnings so we can see more errors. It will print a ton of stuff in your console

Nova-Scotia commented 3 years ago

Thanks so much Mikey,

Your `data_info` file exists: D:/gif_example/data_info.csv.
Your `path_prefix exists: D:/gif_example/small_square_pics.
You are running on a Windows computer.
2021-02-11 15:20:18.550411: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
Namespace(LR_details='19, 30, 44, 53, 0.01, 0.005, 0.001, 0.0005, 0.0001', LR_policy='piecewise_linear', WD_details='30, 0.0005, 0.0', WD_policy='piecewise_linear', architecture='resnet', batch_size=128, chunked_batch_size=64, command='eval', delimiter=',', depth=18, log_debug_info=False, log_device_placement=False, log_dir='species_model', max_to_keep=5, num_batches=-1, num_classes=59, num_epochs=55, num_gpus=2, num_prefetch=2000, num_threads=1, optimizer='momentum', path_prefix='D:/gif_example/small_square_pics', processed_size=[224, 224, 3], raw_size=[256, 256, 3], retrain_from=None, run_metadata=None, run_name='Run-11-02-2021_15-20-18', run_options=None, save_predictions='D:/CameraTrap/MLWIC2_Test/MLWIC2_helper_files/model_predictions_make_gif_59classes.txt', shuffle=True, snapshot_prefix='species_model', top_n=5, train_info=None, transfer_mode=[0], val_info='D:/gif_example/data_info.csv')
found 1 classes
{25: 25}
Filling queue with 2000 images before starting to train. This may take some time.
Traceback (most recent call last):
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\client\session.py", line 1356, in _do_call
    return fn(*args)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\client\session.py", line 1341, in _run_fn
    options, feed_dict, fetch_list, target_list, run_metadata)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\client\session.py", line 1429, in _call_tf_sessionrun
    run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [59] rhs shape= [1000]
     [[{{node save/Assign}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\saver.py", line 1286, in restore
    {self.saver_def.filename_tensor_name: save_path})
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\client\session.py", line 950, in run
    run_metadata_ptr)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\client\session.py", line 1173, in _run
    feed_dict_tensor, options, run_metadata)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\client\session.py", line 1350, in _do_run
    run_metadata)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\client\session.py", line 1370, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [59] rhs shape= [1000]
     [[node save/Assign (defined at D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\architectures\model.py:276) ]]

Errors may have originated from an input operation.
Input Source operations connected to node save/Assign:
 output/biases (defined at D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\architectures\common.py:25)

Original stack trace for 'save/Assign':
  File "run.py", line 412, in <module>
    main()
  File "run.py", line 394, in main
    do_evaluate(sess, args)
  File "run.py", line 236, in do_evaluate
    dnn_model.load(sess, args.log_dir)
  File "D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\architectures\model.py", line 276, in load
    self.pretrained_loader = tf.train.Saver(tf.get_collection(SAVE_VARIABLES))
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\saver.py", line 825, in __init__
    self.build()
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\saver.py", line 837, in build
    self._build(self._filename, build_save=True, build_restore=True)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\saver.py", line 875, in _build
    build_restore=build_restore)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\saver.py", line 508, in _build_internal
    restore_sequentially, reshape)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\saver.py", line 350, in _AddRestoreOps
    assign_ops.append(saveable.restore(saveable_tensors, shapes))
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\saving\saveable_object_util.py", line 72, in restore
    self.op.get_shape().is_fully_defined())
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\ops\state_ops.py", line 227, in assign
    validate_shape=validate_shape)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\ops\gen_state_ops.py", line 65, in assign
    use_locking=use_locking, name=name)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
    op_def=op_def)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op
    op_def=op_def)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\framework\ops.py", line 2005, in __init__
    self._traceback = tf_stack.extract_stack()

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "run.py", line 412, in <module>
    main()
  File "run.py", line 394, in main
    do_evaluate(sess, args)
  File "run.py", line 236, in do_evaluate
    dnn_model.load(sess, args.log_dir)
  File "D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\architectures\model.py", line 279, in load
    self.pretrained_loader.restore(sess, ckpt.model_checkpoint_path)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\saver.py", line 1322, in restore
    err, "a mismatch between the current graph and the graph")
tensorflow.python.framework.errors_impl.InvalidArgumentError: Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:

Assign requires shapes of both tensors to match. lhs shape= [59] rhs shape= [1000]
     [[node save/Assign (defined at D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\architectures\model.py:276) ]]

Errors may have originated from an input operation.
Input Source operations connected to node save/Assign:
 output/biases (defined at D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\architectures\common.py:25)

Original stack trace for 'save/Assign':
  File "run.py", line 412, in <module>
    main()
  File "run.py", line 394, in main
    do_evaluate(sess, args)
  File "run.py", line 236, in do_evaluate
    dnn_model.load(sess, args.log_dir)
  File "D:\CameraTrap\MLWIC2_Test\MLWIC2_helper_files\architectures\model.py", line 276, in load
    self.pretrained_loader = tf.train.Saver(tf.get_collection(SAVE_VARIABLES))
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\saver.py", line 825, in __init__
    self.build()
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\saver.py", line 837, in build
    self._build(self._filename, build_save=True, build_restore=True)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\saver.py", line 875, in _build
    build_restore=build_restore)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\saver.py", line 508, in _build_internal
    restore_sequentially, reshape)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\saver.py", line 350, in _AddRestoreOps
    assign_ops.append(saveable.restore(saveable_tensors, shapes))
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\training\saving\saveable_object_util.py", line 72, in restore
    self.op.get_shape().is_fully_defined())
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\ops\state_ops.py", line 227, in assign
    validate_shape=validate_shape)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\ops\gen_state_ops.py", line 65, in assign
    use_locking=use_locking, name=name)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 788, in _apply_op_helper
    op_def=op_def)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\util\deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\framework\ops.py", line 3616, in create_op
    op_def=op_def)
  File "C:\Users\NewtonEr\Anaconda\lib\site-packages\tensorflow\python\framework\ops.py", line 2005, in __init__
    self._traceback = tf_stack.extract_stack()

The classify function did not run properly.