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

Errors when testing mat mode/model #28

Open
ghost opened this issue Jan 23, 2020 · 0 comments
Open

Errors when testing mat mode/model #28

ghost opened this issue Jan 23, 2020 · 0 comments

Comments

@ghost
Copy link

ghost commented Jan 23, 2020

seg, seg+, and seg tri modes all work, but when I try to test mat mode, I get errors.

As an example, an input of 'python scripts/test.py -i scripts/io/synth1r.jpg -o scripts/io/synth1_mat_30k.jpg --mode mat --model_path model_best_mat.npz' returns:

[2020/01/23 16:13:28.132] INFO (8424) config    : Load config from "config.json"
[2020/01/23 16:13:28.132] INFO (8424) models    : Create FCN8s-Matting
Traceback (most recent call last):
  File "scripts/test.py", line 169, in <module>
    main(sys.argv[1:])
  File "scripts/test.py", line 130, in main
    config.mean_mask_filepath)
  File "scripts/test.py", line 36, in __init__
    chainer.serializers.load_npz(model_path, self._model)
  File "C:\Users\usr\AppData\Local\Continuum\anaconda3\lib\site-packages\chainer\serializers\npz.py", line 243, in load_npz
    d.load(obj)
  File "C:\Users\usr\AppData\Local\Continuum\anaconda3\lib\site-packages\chainer\serializer.py", line 83, in load
    obj.serialize(self)
  File "C:\Users\usr\AppData\Local\Continuum\anaconda3\lib\site-packages\chainer\link.py", line 1026, in serialize
    d[name].serialize(serializer[name])
  File "C:\Users\usr\AppData\Local\Continuum\anaconda3\lib\site-packages\chainer\link.py", line 657, in serialize
    data = serializer(name, param.data)  # type: types.NdArray
  File "C:\Users\usr\AppData\Local\Continuum\anaconda3\lib\site-packages\chainer\serializers\npz.py", line 185, in __call__
    numpy.copyto(value, dataset)
ValueError: could not broadcast input array from shape (2,2,4,4) into shape (3,3,4,4)

Actually, I get slightly different errors, even when trying again immediately, such as:

[2020/01/23 16:15:28.550] INFO (3788) config    : Load config from "config.json"
[2020/01/23 16:15:28.551] INFO (3788) models    : Create FCN8s-Matting
Traceback (most recent call last):
  File "scripts/test.py", line 169, in <module>
    main(sys.argv[1:])
  File "scripts/test.py", line 130, in main
    config.mean_mask_filepath)
  File "scripts/test.py", line 36, in __init__
    chainer.serializers.load_npz(model_path, self._model)
  File "C:\Users\usr\AppData\Local\Continuum\anaconda3\lib\site-packages\chainer\serializers\npz.py", line 243, in load_npz
    d.load(obj)
  File "C:\Users\usr\AppData\Local\Continuum\anaconda3\lib\site-packages\chainer\serializer.py", line 83, in load
    obj.serialize(self)
  File "C:\Users\usr\AppData\Local\Continuum\anaconda3\lib\site-packages\chainer\link.py", line 1026, in serialize
    d[name].serialize(serializer[name])
  File "C:\Users\usr\AppData\Local\Continuum\anaconda3\lib\site-packages\chainer\link.py", line 657, in serialize
    data = serializer(name, param.data)  # type: types.NdArray
  File "C:\Users\usr\AppData\Local\Continuum\anaconda3\lib\site-packages\chainer\serializers\npz.py", line 185, in __call__
    numpy.copyto(value, dataset)
ValueError: could not broadcast input array from shape (2) into shape (3)

or

[2020/01/23 16:16:36.992] INFO (12892) config   : Load config from "config.json"
[2020/01/23 16:16:36.992] INFO (12892) models   : Create FCN8s-Matting
Traceback (most recent call last):
  File "scripts/test.py", line 169, in <module>
    main(sys.argv[1:])
  File "scripts/test.py", line 130, in main
    config.mean_mask_filepath)
  File "scripts/test.py", line 36, in __init__
    chainer.serializers.load_npz(model_path, self._model)
  File "C:\Users\usr\AppData\Local\Continuum\anaconda3\lib\site-packages\chainer\serializers\npz.py", line 243, in load_npz
    d.load(obj)
  File "C:\Users\usr\AppData\Local\Continuum\anaconda3\lib\site-packages\chainer\serializer.py", line 83, in load
    obj.serialize(self)
  File "C:\Users\usr\AppData\Local\Continuum\anaconda3\lib\site-packages\chainer\link.py", line 1026, in serialize
    d[name].serialize(serializer[name])
  File "C:\Users\usr\AppData\Local\Continuum\anaconda3\lib\site-packages\chainer\link.py", line 657, in serialize
    data = serializer(name, param.data)  # type: types.NdArray
  File "C:\Users\usr\AppData\Local\Continuum\anaconda3\lib\site-packages\chainer\serializers\npz.py", line 185, in __call__
    numpy.copyto(value, dataset)
ValueError: could not broadcast input array from shape (2,2,16,16) into shape (3,3,16,16)

Any ideas? Do we have to supply the trimap output of the seg tri model to the mat mode? I've seen some other projects where that is required, but didn't see that in the documentation here.

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

0 participants