matterport / Mask_RCNN

Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow
Other
24.65k stars 11.7k forks source link

GPU not in use #1234

Open ehsanpi opened 5 years ago

ehsanpi commented 5 years ago

The code runs only on CPU. I guess the error arises due to the this message: " Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2". Can you kindly explain why?

BTW, I followed all instructions and requirements both in Conda and without. I successfully ran the cuda sample with GPU full usage.

OS: Windows 10 GPU: NVIDIA 1080 Cuda: 9.0 cuDNN: 7.4.2 Python: 3.6

4sfaloth commented 5 years ago

" Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2".

That error message is unrelated I think. It just means that, in order to get maximum speed when running in CPU, you must build Tensorflow yourself with AVX2 enabled. They are disabled by default so that the distributed binaries work in all machines (and some do not support AVX2)

As to not using GPU, I can think of two reasons for that: In the config.py file, is GPU_COUNT set to 1? If it is set to 0 it will not use it Do you have tensorflow-gpu installed? If you only have tensorflow it will run on CPU

ehsanpi commented 5 years ago

Thanks 4sfaloth. It was great. I could install it properly.

mymultiverse commented 5 years ago

In the config.py file, is GPU_COUNT set to 1? If it is set to 0 it will not use it

But here it says 1 for CPU https://github.com/matterport/Mask_RCNN/blob/master/mrcnn/config.py#L27

Correct me if I am missing something.

qchenclaire commented 5 years ago

The code runs only on CPU. I guess the error arises due to the this message: " Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2". Can you kindly explain why?

BTW, I followed all instructions and requirements both in Conda and without. I successfully ran the cuda sample with GPU full usage.

OS: Windows 10 GPU: NVIDIA 1080 Cuda: 9.0 cuDNN: 7.4.2 Python: 3.6

The code runs only on CPU. I guess the error arises due to the this message: " Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2". Can you kindly explain why?

BTW, I followed all instructions and requirements both in Conda and without. I successfully ran the cuda sample with GPU full usage.

OS: Windows 10 GPU: NVIDIA 1080 Cuda: 9.0 cuDNN: 7.4.2 Python: 3.6

When you run pip3 install -r requirements.txt, a cpu version of tensorflow is automatically installed. Uninstall it and reinstall a gpu version

liuxin00738 commented 5 years ago

Can you provide some suggestions on how to install the required GPU version correctly? I am having trouble install it. I am trying to install it inside a gpu tensorflow docker.

ouguozhen commented 5 years ago

Can you provide some suggestions on how to install the required GPU version correctly? I am having trouble install it. I am trying to install it inside a gpu tensorflow docker.

pip uninstall tensorflow && pip install tensorflow-gpu

ngocson1804 commented 5 years ago

" Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2".

That error message is unrelated I think. It just means that, in order to get maximum speed when running in CPU, you must build Tensorflow yourself with AVX2 enabled. They are disabled by default so that the distributed binaries work in all machines (and some do not support AVX2)

As to not using GPU, I can think of two reasons for that: In the config.py file, is GPU_COUNT set to 1? If it is set to 0 it will not use it Do you have tensorflow-gpu installed? If you only have tensorflow it will run on CPU

I hev the same issue. But I already install tenorflow-gpu and set GPU_COUNT = 2. it still run on CPU, not on GPU. Could you help me?

JuniorTakam commented 8 months ago

Good moorning to you please, I have some problem. when I run Mask RCNN for crater dectection, I got this error:

[ 0.7614669 0.5845174 1.1143883 1.2913378 ]]] 2024-03-05 06:50:19.778224: W tensorflow/core/framework/op_kernel.cc:1753] OP_REQUIRES failed at strided_slice_op.cc:108 : Invalid argument: slice index 1 of dimension 0 out of bounds. 2024-03-05 06:50:19.783188: W tensorflow/core/framework/op_kernel.cc:1753] OP_REQUIRES failed at strided_slice_op.cc:108 : Invalid argument: slice index 1 of dimension 0 out of bounds. 2024-03-05 06:50:19.783738: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 67108864 exceeds 10% of free system memory. 2024-03-05 06:50:19.911323: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 67108864 exceeds 10% of free system memory. 2024-03-05 06:50:23.824540: W tensorflow/core/framework/op_kernel.cc:1753] OP_REQUIRES failed at strided_slice_op.cc:108 : Invalid argument: slice index 1 of dimension 0 out of bounds. 2024-03-05 06:50:23.830073: W tensorflow/core/framework/op_kernel.cc:1753] OP_REQUIRES failed at strided_slice_op.cc:108 : Invalid argument: slice index 1 of dimension 0 out of bounds. 2024-03-05 06:50:23.834308: W tensorflow/core/framework/op_kernel.cc:1753] OP_REQUIRES failed at strided_slice_op.cc:108 : Invalid argument: slice index 1 of dimension 0 out of bounds. Traceback (most recent call last): File "crater.py", line 365, in video_path=args.video) File "crater.py", line 230, in detect_and_color_splash r = model.detect([image], verbose=1)[0] File "C:\Users\juteno\projet\11\MaskRCNN-master\samples\crater\mrcnn\model.py", line 2627, in detect detections, , _, mrcnnmask, , , = self.keras_model.predict([molded_images, image_metas, anchors], verbose=0) File "C:\Users\juteno\anaconda3\envs\rcnn11\lib\site-packages\keras\engine\training.py", line 1462, in predict callbacks=callbacks) File "C:\Users\juteno\anaconda3\envs\rcnn11\lib\site-packages\keras\engine\training_arrays.py", line 324, in predict_loop batch_outs = f(ins_batch) File "C:\Users\juteno\anaconda3\envs\rcnn11\lib\site-packages\tensorflow\python\keras\backend.py", line 3792, in call outputs = self._graph_fn(*converted_inputs) File "C:\Users\juteno\anaconda3\envs\rcnn11\lib\site-packages\tensorflow\python\eager\function.py", line 1605, in call return self._call_impl(args, kwargs) File "C:\Users\juteno\anaconda3\envs\rcnn11\lib\site-packages\tensorflow\python\eager\function.py", line 1645, in _call_impl return self._call_flat(args, self.captured_inputs, cancellation_manager) File "C:\Users\juteno\anaconda3\envs\rcnn11\lib\site-packages\tensorflow\python\eager\function.py", line 1746, in _call_flat ctx, args, cancellation_manager=cancellation_manager)) File "C:\Users\juteno\anaconda3\envs\rcnn11\lib\site-packages\tensorflow\python\eager\function.py", line 598, in call ctx=ctx) File "C:\Users\juteno\anaconda3\envs\rcnn11\lib\site-packages\tensorflow\python\eager\execute.py", line 60, in quick_execute inputs, attrs, num_outputs) tensorflow.python.framework.errors_impl.InvalidArgumentError: slice index 1 of dimension 0 out of bounds. [[node ROI/strided_slice_12 (defined at C:\Users\juteno\anaconda3\envs\rcnn11\lib\site-packages\keras\backend\tensorflow_backend.py:3009) ]] [Op:__inference_keras_scratch_graph_14630]

Function call stack: keras_scratch_graph

(rcnn11) C:\Users\juteno\projet\11\Mask_RCNN-master\samples\crater>

could someone help me please ?