zhou13 / lcnn

LCNN: End-to-End Wireframe Parsing
MIT License
505 stars 94 forks source link

How do I visualize the output? #4

Closed asunyz closed 4 years ago

asunyz commented 5 years ago
  1. I tried running "python ./post.py --plot --thresholds="0.010,0.015" logs/RUN/npz/ITERATION post/RUN-ITERATION" after I have trained the neural network, and I get error messages like this:

(lcnn) yus174@yixing:~/lcnn$ python ./post.py --plot --thresholds="0.010,0.015" logs/190719-160137-437ef29-baseline/npz/000480000 post/test Processing logs/190719-160137-437ef29-baseline/npz/000480000/000000.npz Processing logs/190719-160137-437ef29-baseline/npz/000480000/000001.npz Processing logs/190719-160137-437ef29-baseline/npz/000480000/000002.npz Processing logs/190719-160137-437ef29-baseline/npz/000480000/000003.npz Processing logs/190719-160137-437ef29-baseline/npz/000480000/000004.npz Processing logs/190719-160137-437ef29-baseline/npz/000480000/000005.npz Processing logs/190719-160137-437ef29-baseline/npz/000480000/000006.npz Processing logs/190719-160137-437ef29-baseline/npz/000480000/000007.npz Processing logs/190719-160137-437ef29-baseline/npz/000480000/000008.npz Processing logs/190719-160137-437ef29-baseline/npz/000480000/000009.npz Processing logs/190719-160137-437ef29-baseline/npz/000480000/000010.npz Processing logs/190719-160137-437ef29-baseline/npz/000480000/000011.npz Process Process-4: Traceback (most recent call last): File "/home/yus174/anaconda3/envs/lcnn/lib/python3.7/site-packages/matplotlib/axes/_axes.py", line 4277, in _parse_scatter_color_args colors = mcolors.to_rgba_array(c) File "/home/yus174/anaconda3/envs/lcnn/lib/python3.7/site-packages/matplotlib/colors.py", line 286, in to_rgba_array result[i] = to_rgba(cc, alpha) File "/home/yus174/anaconda3/envs/lcnn/lib/python3.7/site-packages/matplotlib/colors.py", line 177, in to_rgba rgba = _to_rgba_no_colorcycle(c, alpha) File "/home/yus174/anaconda3/envs/lcnn/lib/python3.7/site-packages/matplotlib/colors.py", line 231, in _to_rgba_no_colorcycle raise ValueError("Invalid RGBA argument: {!r}".format(orig_c)) ValueError: Invalid RGBA argument: 's'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/yus174/anaconda3/envs/lcnn/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap self.run() File "/home/yus174/anaconda3/envs/lcnn/lib/python3.7/multiprocessing/process.py", line 99, in run self._target(*self._args, self._kwargs) File "/home/yus174/lcnn/lcnn/utils.py", line 75, in parallel_handle q_out.put((i, f(x))) File "./post.py", line 182, in handle plt.scatter(a[1], a[0], *PLTOPTS) File "/home/yus174/anaconda3/envs/lcnn/lib/python3.7/site-packages/matplotlib/pyplot.py", line 2841, in scatter None else {}), **kwargs) File "/home/yus174/anaconda3/envs/lcnn/lib/python3.7/site-packages/matplotlib/init__.py", line 1589, in inner return func(ax, *map(sanitize_sequence, args), kwargs) File "/home/yus174/anaconda3/envs/lcnn/lib/python3.7/site-packages/matplotlib/axes/_axes.py", line 4446, in scatter get_next_color_func=self._get_patches_for_fill.get_next_color) File "/home/yus174/anaconda3/envs/lcnn/lib/python3.7/site-packages/matplotlib/axes/_axes.py", line 4298, in _parse_scatter_color_args .format(c) # note: could be long depending on c ValueError: 'c' argument must be a mpl color, a sequence of mpl colors or a sequence of numbers, not s. Process Process-8: Traceback (most recent call last): File "/home/yus174/anaconda3/envs/lcnn/lib/python3.7/site-packages/matplotlib/axes/_axes.py", line 4277, in _parse_scatter_color_args colors = mcolors.to_rgba_array(c) File "/home/yus174/anaconda3/envs/lcnn/lib/python3.7/site-packages/matplotlib/colors.py", line 286, in to_rgba_array result[i] = to_rgba(cc, alpha) File "/home/yus174/anaconda3/envs/lcnn/lib/python3.7/site-packages/matplotlib/colors.py", line 177, in to_rgba rgba = _to_rgba_no_colorcycle(c, alpha) File "/home/yus174/anaconda3/envs/lcnn/lib/python3.7/site-packages/matplotlib/colors.py", line 231, in _to_rgba_no_colorcycle raise ValueError("Invalid RGBA argument: {!r}".format(orig_c)) ValueError: Invalid RGBA argument: 's' ...... (The rest truncated for brevity) The other two evaluations without post-processing worked fine for me.

  1. It seems this script is processing and visualizing the test results generated during training. How do I generate results on novel images that are not included in the test set?
zhou13 commented 5 years ago
  1. This is a problem caused by matplotlib 3.0 upgrade. It is fixed in master now.

  2. Currently, there is no one-stop method to do this. I am working on a script. But if you need it right now you can refer to dataset/wireframe.py to make your dataset and change the content of lines to arbitrary values.

asunyz commented 5 years ago

Thank you for your help. =)

siyuada commented 5 years ago

Hey, If I just wanna test my own image, how this line sample module work, since there are no static and dynamic sample groundtruth?

zhou13 commented 5 years ago

If you need it right now you can refer to dataset/wireframe.py to make your dataset and change the content of lines to arbitrary values. The static and dynamic samplers are not used during testing.

Uni-Summer commented 5 years ago

Hi, when I run dataset/wireframe.py on my own dataset, there is no .json file. So can you tell me where this file comes from? That's very kind of you.

zhou13 commented 5 years ago

You can refer to the "Processing the Dataset" section to download the json files.

Uni-Summer commented 5 years ago

You can refer to the "Processing the Dataset" section to download the json files.

OK. Thank you for your quick reply.

DaddyWesker commented 4 years ago

You can refer to the "Processing the Dataset" section to download the json files.

I guess question is - how to create json files for random dataset since json file contains lines' coordinates (ground truth data)? And is this labels necessary if i'm just want to run your network on some of my images? __ So, main question is (because you referring to this issue in the issue "how to test model on a single image" i'm asking it there) - how to test your code on a random image which has no GT data? Since process.py reads directory with images (loader = torch.utils.data.DataLoader(WireframeDataset...) ) and npz data and considers folder empty if no npz data could be found.

DaddyWesker commented 4 years ago

Oh well... I've somehow made it. Just used one of your npz files and placed it near my image 000000_0

But maybe there are way to not use those npz's?

zhou13 commented 4 years ago

See the updated README.

jamesbc123 commented 11 months ago

If you need it right now you can refer to dataset/wireframe.py to make your dataset and change the content of lines to arbitrary values. The static and dynamic samplers are not used during testing.

It seems to me that the sample_lines function is run during validation and testing. And in this function is requires N, which is the length of junc (from the ground truth). The demo initialises a tensor ("junc": torch.zeros(1, 2).to(device)) which doesn't have this information of course, but I get errors because I'm indexing out of range.

Is there not a way to completely separate train from test and val? I don't like that the forward function in line_vectoriser requires the gt. I would like to completely separate this.