rpautrat / SuperPoint

Efficient neural feature detector and descriptor
MIT License
1.88k stars 416 forks source link

the problem of visualize #253

Open shanchanggo opened 2 years ago

shanchanggo commented 2 years ago

Hi,friends! good morning, I am coming again! I have finished trained of magic-point and superpoint. Thanks to your help! Now, I am trying visualization, some problems occurred! 2022-05-11 11-09-09 的屏幕截图

When I run this in visualize_synthetic-shapes.ipynb,error occurred!

for i in range(8): plotimgs([display(next(data))/255. for in range(4)], dpi=200)

UnimplementedError Traceback (most recent call last)

~/anaconda3/envs/sp/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, args) 1355 try: -> 1356 return fn(args) 1357 except errors.OpError as e:

~/anaconda3/envs/sp/lib/python3.6/site-packages/tensorflow/python/client/session.py in _run_fn(feed_dict, fetch_list, target_list, options, run_metadata) 1340 return self._call_tf_sessionrun( -> 1341 options, feed_dict, fetch_list, target_list, run_metadata) 1342

~/anaconda3/envs/sp/lib/python3.6/site-packages/tensorflow/python/client/session.py in _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata) 1428 self._session, options, feed_dict, fetch_list, target_list, -> 1429 run_metadata) 1430

UnimplementedError: Depthwise convolution on CPU is only supported for NHWC format [[{{node gaussian_blur/depthwise}}]] [[IteratorGetNext_5]]

During handling of the above exception, another exception occurred:

UnimplementedError Traceback (most recent call last)

in 1 for i in range(8): ----> 2 plot_imgs([display(next(data))/255. for _ in range(4)], dpi=200) in (.0) 1 for i in range(8): ----> 2 plot_imgs([display(next(data))/255. for _ in range(4)], dpi=200) ~/lsc/superpoint/SuperPoint-master/superpoint/datasets/base_dataset.py in _get_set_generator(self, set_name) 113 def _get_set_generator(self, set_name): 114 while True: --> 115 yield self.sess.run(self.tf_next[set_name]) ~/anaconda3/envs/sp/lib/python3.6/site-packages/tensorflow/python/client/session.py in run(self, fetches, feed_dict, options, run_metadata) 948 try: 949 result = self._run(None, fetches, feed_dict, options_ptr, --> 950 run_metadata_ptr) 951 if run_metadata: 952 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr) ~/anaconda3/envs/sp/lib/python3.6/site-packages/tensorflow/python/client/session.py in _run(self, handle, fetches, feed_dict, options, run_metadata) 1171 if final_fetches or final_targets or (handle and feed_dict_tensor): 1172 results = self._do_run(handle, final_targets, final_fetches, -> 1173 feed_dict_tensor, options, run_metadata) 1174 else: 1175 results = [] ~/anaconda3/envs/sp/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata) 1348 if handle is None: 1349 return self._do_call(_run_fn, feeds, fetches, targets, options, -> 1350 run_metadata) 1351 else: 1352 return self._do_call(_prun_fn, handle, feeds, fetches) ~/anaconda3/envs/sp/lib/python3.6/site-packages/tensorflow/python/client/session.py in _do_call(self, fn, *args) 1368 pass 1369 message = error_interpolation.interpolate(message, self._graph) -> 1370 raise type(e)(node_def, op, message) 1371 1372 def _extend_graph(self): UnimplementedError: Depthwise convolution on CPU is only supported for NHWC format [[{{node gaussian_blur/depthwise}}]] [[IteratorGetNext_5]] I think it did not recognize my gpu! so what should I do to solve it?
rpautrat commented 2 years ago

Hi, I cannot help you here, it is dependent of your machine and you will have to find a way to make your GPU visible somehow... Unfortunately this repo can only work on GPU.

shanchanggo commented 2 years ago

em... watch it! 2022-05-11 15-49-25 的屏幕截图 gpu has got! but still have error. what cause it,do you know ?

shanchanggo commented 2 years ago

2022-05-17 21-36-14 的屏幕截图

When I train it at step1, the machine can find gpu and run normally! but when i run the visualize_synthetic-shapes.ipynb,

import cv2 import numpy as np from superpoint.datasets.synthetic_shapes import SyntheticShapes from superpoint.notebooks.utils import plot_imgs

config = { 'primitives': 'all', 'on-the-fly': True, 'preprocessing': {'resize': [120, 160], 'blur_size': 21} } dataset = SyntheticShapes(**config) data = dataset.get_test_set()

def draw_keypoints(img, corners, color): keypoints = [cv2.KeyPoint(c[1], c[0], 1) for c in np.stack(corners).T] return cv2.drawKeypoints(img.astype(np.uint8), keypoints, None, color=color) def display(d): return draw_keypoints(d['image'][..., 0] * 255, np.where(d['keypoint_map']), (0, 255, 0))

for i in range(8): plotimgs([display(next(data))/255. for in range(4)], dpi=200)

2022-05-17 21-42-01 的屏幕截图

I don't know how to solve it . if you have time ,please help me. it is important! Thank you

rpautrat commented 2 years ago

Hi, sorry for the late reply. I have never had this issue in my case, and I am not sure how to solve it unfortunately. If you could localize where this depthwise convolution is happening in the code, you could try to convert to NHWC format as required by the error message. But from the current error message, the origin of the error is not obvious... You will have to debug by yourself I am afraid.