Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Incorrect number of features. Got 4 features, expected 3 #8

Open
ProGamerGov opened this issue Feb 19, 2018 · 4 comments
Open

Comments

@ProGamerGov
Copy link

ubuntu@ip-Address:~/fast-neural-doodle$ python get_mask_hdf5.py --n_colors=5 --style_image=Monet2.jpg --style_mask=Monet2_sem2_r.png --target_mask=MonetNew2_sem2.png
Traceback (most recent call last):
  File "get_mask_hdf5.py", line 45, in <module>
    labels_target = kmeans.predict(target_flatten.astype(float))
  File "/usr/lib/python2.7/dist-packages/sklearn/cluster/k_means_.py", line 889, in predict
    X = self._check_test_data(X)
  File "/usr/lib/python2.7/dist-packages/sklearn/cluster/k_means_.py", line 800, in _check_test_data
    n_features, expected_n_features))
ValueError: Incorrect number of features. Got 4 features, expected 3
ubuntu@ip-Address:~/fast-neural-doodle$
ubuntu@ip-Address:~/fast-neural-doodle$ python get_mask_hdf5.py --n_colors=3 --style_image=Monet2.jpg --style_mask=Monet2_sem2_r.png --target_mask=MonetNew2_sem2.png
Traceback (most recent call last):
  File "get_mask_hdf5.py", line 45, in <module>
    labels_target = kmeans.predict(target_flatten.astype(float))
  File "/usr/lib/python2.7/dist-packages/sklearn/cluster/k_means_.py", line 889, in predict
    X = self._check_test_data(X)
  File "/usr/lib/python2.7/dist-packages/sklearn/cluster/k_means_.py", line 800, in _check_test_data
    n_features, expected_n_features))
ValueError: Incorrect number of features. Got 4 features, expected 3
ubuntu@ip-Address:~/fast-neural-doodle$

There are 5 distinct color regions on my masks.

@ProGamerGov
Copy link
Author

So it turns out that I needed a content image in addition to the content mask:

python get_mask_hdf5.py --n_colors=5 --style_image=data/Monet2/style.png --style_mask=data/Monet2/style_mask_fix.png --target_mask=data/Monet2/monetblank_mask.png

I added an image that was the same size as monetblank_mask.png to the Monet2 directory and named it monetblank.png. Then it worked.

@ProGamerGov
Copy link
Author

That actually wasn't a fix. It's still broken.

@ProGamerGov ProGamerGov reopened this Feb 19, 2018
@ProGamerGov
Copy link
Author

My style and content masks have the exact same number of colors, and the exact same colors.

Here at the input images that I'm trying to use:

The Style Image:

Style Mask:

Content Mask:

@ProGamerGov
Copy link
Author

@DmitryUlyanov Do you have any ideas on what is causing this odd issue, and how to resolve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant