Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Default MaxPoolingOp only supports NHWC on device type CPU #22

Closed
lakefox opened this issue Aug 11, 2020 · 1 comment
Closed

Default MaxPoolingOp only supports NHWC on device type CPU #22

lakefox opened this issue Aug 11, 2020 · 1 comment

Comments

@lakefox
Copy link

lakefox commented Aug 11, 2020

Hi, I keep getting the same error "Default MaxPoolingOp only supports NHWC on device type CPU" every time I run it. I'm running it on a MacBook Pro so it's the only CPU, does thid work on CPU machines or only CPU/GPU?

Also sorry if this is a newbie question I am still learning TensorFlow.

Here's the full error message.

% python3.7 obj_detect_tracking.py --model_path obj_v3_model --version 3 --video_dir v1-val_testvideos \
--video_lst_file v1-val_testvideos.lst --frame_gap 1 --get_tracking
--tracking_dir test_track_out

0%| | 0/1 [00:02<?, ?it/s]
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1365, in _do_call
return fn(*args)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1350, in _run_fn
target_list, run_metadata)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Default MaxPoolingOp only supports NHWC on device type CPU
[[{{node pool0/max_pooling2d/MaxPool}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "obj_detect_tracking.py", line 647, in
sess_input, feed_dict=feed_dict)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 956, in run
run_metadata_ptr)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1180, in _run
feed_dict_tensor, options, run_metadata)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1359, in _do_run
run_metadata)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1384, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Default MaxPoolingOp only supports NHWC on device type CPU
[[node pool0/max_pooling2d/MaxPool (defined at /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py:1748) ]]

Original stack trace for 'pool0/max_pooling2d/MaxPool':
File "obj_detect_tracking.py", line 517, in
model = get_model(args, args.gpuid_start, controller=args.controller)
File "/Users/masonwright/Desktop/objdection/od/models.py", line 110, in get_model
model = Mask_RCNN_FPN(config, gpuid=gpuid)
File "/Users/masonwright/Desktop/objdection/od/models.py", line 292, in init
self.build_forward()
File "/Users/masonwright/Desktop/objdection/od/models.py", line 479, in build_forward
use_se=config.use_se, use_resnext=config.use_resnext)
File "/Users/masonwright/Desktop/objdection/od/nn.py", line 895, in resnet_fpn_backbone
scope="pool0", data_format="NCHW")
File "/Users/masonwright/Desktop/objdection/od/nn.py", line 790, in MaxPooling
"channels_last" if data_format == "NHWC" else "channels_first")
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/util/deprecation.py", line 324, in new_func
return func(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/layers/pooling.py", line 311, in max_pooling2d
return layer.apply(inputs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/util/deprecation.py", line 324, in new_func
return func(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/base_layer.py", line 1700, in apply
return self.call(inputs, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/layers/base.py", line 548, in call
outputs = super(Layer, self).call(inputs, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/base_layer.py", line 854, in call
outputs = call_fn(cast_inputs, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/autograph/impl/api.py", line 234, in wrapper
return converted_call(f, options, args, kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/autograph/impl/api.py", line 439, in converted_call
return _call_unconverted(f, args, kwargs, options)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/autograph/impl/api.py", line 330, in _call_unconverted
return f(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/keras/layers/pooling.py", line 248, in call
data_format=conv_utils.convert_data_format(self.data_format, 4))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/ops/nn_ops.py", line 3815, in max_pool
name=name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/ops/gen_nn_ops.py", line 5674, in max_pool
data_format=data_format, name=name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/framework/op_def_library.py", line 794, in _apply_op_helper
op_def=op_def)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 3357, in create_op
attrs, op_def, compute_device)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 3426, in _create_op_internal
op_def=op_def)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1748, in init
self._traceback = tf_stack.extract_stack()

@JunweiLiang
Copy link
Owner

Hi,

Yes currently the code needs tensorflow-gpu to run. To run it with CPU, you'll need to change a lot of code to make tensor dimensions from [N, C, H, W] to [N, H, W, C].
You can probably try it on colab with free GPUs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants