Model Not working when image size is smaller than (150, 150)

#3
by IMvision12 - opened

colab notebook : https://colab.research.google.com/drive/1ZmKmdGO9ze7ZfKNpgf82bn53BdVv4uav?usp=sharing

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/gradio/routes.py", line 256, in run_predict
    fn_index, raw_input, username, session_state
  File "/usr/local/lib/python3.7/dist-packages/gradio/blocks.py", line 538, in process_api
    predictions, duration = await self.call_function(fn_index, processed_input)
  File "/usr/local/lib/python3.7/dist-packages/gradio/blocks.py", line 453, in call_function
    block_fn.fn, *processed_input, limiter=self.limiter
  File "/usr/local/lib/python3.7/dist-packages/anyio/to_thread.py", line 32, in run_sync
    func, *args, cancellable=cancellable, limiter=limiter
  File "/usr/local/lib/python3.7/dist-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.7/dist-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/usr/local/lib/python3.7/dist-packages/gradio/interface.py", line 496, in <lambda>
    if len(self.output_components) == 1
  File "/usr/local/lib/python3.7/dist-packages/gradio/interface.py", line 678, in run_prediction
    prediction = predict_fn(*processed_input)
  File "<ipython-input-10-5714a1293d29>", line 9, in process_image
    lowres = tf.image.random_crop(lowres, (150, 150, 3))
  File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 161, in Assert
    (condition, "\n".join(data_str)))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Expected 'tf.Tensor(False, shape=(), dtype=bool)' to be true. Summarized data: b'Need value.shape >= size, got '
118, 124, 3
150, 150, 3

I guess there is no need to crop the image.

Then the image has to be scaled up to 150 x 150, because that is the input layer to the CNN.

I'll add that as an info onto the space, and see if I can do something in the space.

Sign up or log in to comment