这里我使用 mask_rcnn 进行对象检测。代码运行正常,但现在我收到以下错误。
代码 :
Testing - 1
# 1 - 200 images testing
# Load a random image from the images folder
file_names = next(os.walk(IMAGE_DIR))[2]
i=0
for fn in file_names:
#image = skimage.io.imread(os.path.join(IMAGE_DIR, random.choice(file_names)))
i = i+1
print(i)
image = skimage.io.imread(os.path.join(IMAGE_DIR, fn))
# Run detection
results = model.detect([image], verbose=1)
# Visualize results
r = results[0]
visualize.display_instances(image, r['rois'], r['masks'], r['class_ids'],
class_names, r['scores'])
错误消息:
1 处理 1 个图像图像形状:(1123, 1588, 3) 最小值:13.00000 最大值:255.00000 uint8 模塑图像形状:(1, 1024, 1024, 3) 最小值:-123.70000 最大值:150.10000 float64 image_metas 形状:(1, 15) 最小值:0.00000 最大值:1588.00000 float64 锚形状:(1, 261888, 4) 最小值:-0.35390 最大值:1.29134 float32 ------------------------ -------------------------------------------------- -- UnknownError Traceback (most recent call last) in 15 16 # 运行检测 ---> 17 results = model.detect([image], verbose=1) 18 19 # 可视化结果
D:\gpu\projects1\Mask_RCNN-Multi-Class-Detection\model.py in detect(self, images, verbose)
2529 # Run object detection
2530 detections, _, _, mrcnn_mask, _, _, _ =\
-> 2531 self.keras_model.predict([molded_images, image_metas, anchors], verbose=0)
2532 # Process detections
2533 results = []
~\Anaconda3\envs\tf-gpu\lib\site-packages\keras\engine\training.py in predict(self, x, batch_size, verbose, steps, callbacks, max_queue_size, workers, use_multiprocessing)
1399 verbose=verbose,
1400 steps=steps,
-> 1401 callbacks=callbacks)
1402
1403 def train_on_batch(self, x, y,
~\Anaconda3\envs\tf-gpu\lib\site-packages\keras\engine\training_arrays.py in predict_loop(model, f, ins, batch_size, verbose, steps, callbacks)
330 batch_logs = {'batch': batch_index, 'size': len(batch_ids)}
331 callbacks._call_batch_hook('predict', 'begin', batch_index, batch_logs)
--> 332 batch_outs = f(ins_batch)
333 batch_outs = to_list(batch_outs)
334 if batch_index == 0:
~\Anaconda3\envs\tf-gpu\lib\site-packages\keras\backend\tensorflow_backend.py in __call__(self, inputs)
2977 return self._legacy_call(inputs)
2978
-> 2979 return self._call(inputs)
2980 else:
2981 if py_any(is_tensor(x) for x in inputs):
~\Anaconda3\envs\tf-gpu\lib\site-packages\keras\backend\tensorflow_backend.py in _call(self, inputs)
2935 fetched = self._callable_fn(*array_vals, run_metadata=self.run_metadata)
2936 else:
-> 2937 fetched = self._callable_fn(*array_vals)
2938 return fetched[:len(self.outputs)]
2939
~\Anaconda3\envs\tf-gpu\lib\site-packages\tensorflow\python\client\session.py in __call__(self, *args, **kwargs)
1456 ret = tf_session.TF_SessionRunCallable(self._session._session,
1457 self._handle, args,
-> 1458 run_metadata_ptr)
1459 if run_metadata:
1460 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)
UnknownError: 2 root error(s) found.
(0) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
[[{{node conv1/convolution}}]]
[[mrcnn_detection/map/TensorArrayUnstack/range/_4207]]
(1) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
[[{{node conv1/convolution}}]]
0 successful operations.
0 derived errors ignored.