HPI-DeepLearning / crnn-lid

Code for the paper Language Identification Using Deep Convolutional Recurrent Neural Networks
GNU General Public License v3.0
105 stars 48 forks source link

ValueError: arrays must all be same length #19

Closed Bini55 closed 4 years ago

Bini55 commented 4 years ago

While running the tsne.py code I'm getting the following error.

Traceback (most recent call last): File "tsne.py", line 100, in visualize_cluster(cli_args) File "tsne.py", line 84, in visualize_cluster plot_with_labels(lowD_weights, labels, config["label_names"], cli_args.plot_name) File "tsne.py", line 17, in plot_with_labels df = DataFrame({"x": lowD_Weights[:, 0], "y": lowD_Weights[:, 1], "label": labels}) File "/home/bini/.local/lib/python3.6/site-packages/pandas/core/frame.py", line 275, in init mgr = self._init_dict(data, index, columns, dtype=dtype) File "/home/bini/.local/lib/python3.6/site-packages/pandas/core/frame.py", line 411, in _init_dict return _arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype) File "/home/bini/.local/lib/python3.6/site-packages/pandas/core/frame.py", line 5496, in _arrays_to_mgr index = extract_index(arrays) File "/home/bini/.local/lib/python3.6/site-packages/pandas/core/frame.py", line 5544, in extract_index raise ValueError('arrays must all be same length') ValueError: arrays must all be same length

Bartzi commented 4 years ago

What exactly did you try to do? Did you install all requirements as pointed out in requirements.txt?

Bartzi commented 4 years ago

yes, you can surely do that. Just add a loop where you load each file, put it through the classifier and save the prediction result. You can then generate your visualizations, e.g. a confusion matrix. Should not be too difficult to that :wink: .

Bartzi commented 4 years ago

oh :sweat_smile: there are still hard coded paths in the code. That is unfortunate...

exchange those paths with paths on your system. in DirectoryLoader.py, line 75 for instance let it point to a folder containing your dataset (i think) and so on. in the end it also highly depends on the structure of your dataset if it is different than expected, it might not work. Your best bet is to try and in case it does not work to adapt some code...