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

Exporting the pre-training model failed #581

Closed
surmo opened this issue Jan 17, 2019 · 2 comments
Closed

Exporting the pre-training model failed #581

surmo opened this issue Jan 17, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@surmo
Copy link

surmo commented Jan 17, 2019

I am use this code to export the pre-model,but it fail

net = gcv.model_zoo.get_model('psp_resnet101_ade', pretrained=True)
export_block('psp_resnet101_ade', net,data_shape=(224, 224, 3), preprocess=True, layout='HWC')

Traceback (most recent call last):
File "I:/Python_project/MachineLearninginAction/exportModel.py", line 6, in
export_block('psp_resnet101_ade', net,data_shape=(224, 224, 3), preprocess=None, layout='HWC')
File "C:\Users\Sumo\AppData\Roaming\Python\Python35\site-packages\gluoncv\utils\export_helper.py", line 109, in export_block
wrapper_block(x)
File "C:\Users\Sumo\AppData\Local\Programs\Python\Python35\lib\site-packages\mxnet\gluon\block.py", line 542, in call
out = self.forward(*args)
File "C:\Users\Sumo\AppData\Local\Programs\Python\Python35\lib\site-packages\mxnet\gluon\block.py", line 909, in forward
return self._call_cached_op(x, *args)
File "C:\Users\Sumo\AppData\Local\Programs\Python\Python35\lib\site-packages\mxnet\gluon\block.py", line 799, in _call_cached_op
self._build_cache(*args)
File "C:\Users\Sumo\AppData\Local\Programs\Python\Python35\lib\site-packages\mxnet\gluon\block.py", line 751, in _build_cache
data, out = self._get_graph(*args)
File "C:\Users\Sumo\AppData\Local\Programs\Python\Python35\lib\site-packages\mxnet\gluon\block.py", line 743, in _get_graph
out = self.hybrid_forward(symbol, *grouped_inputs, **params) # pylint: disable=no-value-for-parameter
File "C:\Users\Sumo\AppData\Roaming\Python\Python35\site-packages\gluoncv\model_zoo\pspnet.py", line 53, in hybrid_forward
x = self.head(c4)
File "C:\Users\Sumo\AppData\Local\Programs\Python\Python35\lib\site-packages\mxnet\gluon\block.py", line 542, in call
out = self.forward(*args)
File "C:\Users\Sumo\AppData\Local\Programs\Python\Python35\lib\site-packages\mxnet\gluon\block.py", line 926, in forward
return self.hybrid_forward(symbol, x, *args, **params)
File "C:\Users\Sumo\AppData\Roaming\Python\Python35\site-packages\gluoncv\model_zoo\pspnet.py", line 115, in hybrid_forward
x = self.psp(x)
File "C:\Users\Sumo\AppData\Local\Programs\Python\Python35\lib\site-packages\mxnet\gluon\block.py", line 542, in call
out = self.forward(*args)
File "C:\Users\Sumo\AppData\Local\Programs\Python\Python35\lib\site-packages\mxnet\gluon\block.py", line 926, in forward
return self.hybrid_forward(symbol, x, *args, **params)
File "C:\Users\Sumo\AppData\Roaming\Python\Python35\site-packages\gluoncv\model_zoo\pspnet.py", line 91, in hybrid_forward
_, _, h, w = x.shape
AttributeError: 'Symbol' object has no attribute 'shape'

@zhreshold
Copy link
Member

I identified several segmentation models are not hybridizable now, since the models use shape inside the graph. For now only FCN models can be exported without issue.

The workaround for PSP and DeepLab models are to remove the line:

_, _, h, w = x.shape

and use fixed shape (e.g., h=w=448)

@zhreshold zhreshold added the enhancement New feature or request label Jan 17, 2019
@zhreshold
Copy link
Member

We are adding it as feature request duplicate in #547 , I am closing this for now, feel free to join the discussion in #547

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

No branches or pull requests

2 participants