-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assertion error while running train_unet.py #12
Comments
when i change this line in train_unet train_xsz = int(3/4 * img_m.shape[0]) to this |
I had the same error. My problem was caused by a difference in data structures. The imagery I wanted to train on was already correctly formatted, so I did not need to use numpy.transpose() to get img.shape and mask.shape in the proper order (X, Y, channels). Changing train_unet.py to transpose the data into the correct format should help you clear the assertion check. |
Thank you, it was useful! |
Hello , can somone help me please in this code , when i run the Train_unet i get this error : start train net InvalidArgumentError Traceback (most recent call last) InvalidArgumentError: Negative dimension size caused by subtracting 2 from 1 for 'max_pooling2d_20/MaxPool' (op: 'MaxPool') with input shapes: [?,1,1,512]. During handling of the above exception, another exception occurred: ValueError Traceback (most recent call last) in train_net() in get_model() ~\Desktop\Unet\deep-unet-for-satellite-image-segmentation-master\unet_model.py in unet_model(n_classes, im_sz, n_channels, n_filters_start, growth_factor, upconv, class_weights) ~\anaconda3\envs\tf3\lib\site-packages\keras\backend\tensorflow_backend.py in symbolic_fn_wrapper(*args, **kwargs) ~\anaconda3\envs\tf3\lib\site-packages\keras\engine\base_layer.py in call(self, inputs, **kwargs) ~\anaconda3\envs\tf3\lib\site-packages\keras\layers\pooling.py in call(self, inputs) ~\anaconda3\envs\tf3\lib\site-packages\keras\layers\pooling.py in _pooling_function(self, inputs, pool_size, strides, padding, data_format) ~\anaconda3\envs\tf3\lib\site-packages\keras\backend\tensorflow_backend.py in pool2d(x, pool_size, strides, padding, data_format, pool_mode) ~\anaconda3\envs\tf3\lib\site-packages\tensorflow_core\python\ops\nn_ops.py in max_pool_v2(input, ksize, strides, padding, data_format, name) ~\anaconda3\envs\tf3\lib\site-packages\tensorflow_core\python\ops\gen_nn_ops.py in max_pool(input, ksize, strides, padding, data_format, name) ~\anaconda3\envs\tf3\lib\site-packages\tensorflow_core\python\framework\op_def_library.py in _apply_op_helper(op_type_name, name, **keywords) ~\anaconda3\envs\tf3\lib\site-packages\tensorflow_core\python\framework\func_graph.py in _create_op_internal(self, op_type, inputs, dtypes, input_types, name, attrs, op_def, compute_device) ~\anaconda3\envs\tf3\lib\site-packages\tensorflow_core\python\framework\ops.py in _create_op_internal(self, op_type, inputs, dtypes, input_types, name, attrs, op_def, compute_device) ~\anaconda3\envs\tf3\lib\site-packages\tensorflow_core\python\framework\ops.py in init(self, node_def, g, inputs, output_types, control_inputs, input_types, original_op, op_def) ~\anaconda3\envs\tf3\lib\site-packages\tensorflow_core\python\framework\ops.py in _create_c_op(graph, node_def, inputs, control_inputs) ValueError: Negative dimension size caused by subtracting 2 from 1 for 'max_pooling2d_20/MaxPool' (op: 'MaxPool') with input shapes: [?,1,1,512]. |
assert len(img.shape) == 3 and img.shape[0] > sz and img.shape[1] > sz and img.shape[0:2] == mask.shape[0:2]
this is getting Assertion error while running train_unet.py
how to resolve this?
The text was updated successfully, but these errors were encountered: