Comments (7)
233, model 1 has no error just now after I change the feature map size.
And the final res of model is accurate.
from tinyneuralnetwork.
@nonononentity Would you please share the models in TorchScript format, which can be exported via the following code? Please also tell us the shape of the input tensors.
script = torch.jit.trace(model, dummy_input)
torch.jit.save(script, 'model.pt')
from tinyneuralnetwork.
I have changed my builder script, please try my history version.
model_1.zip
This model should be same as "model_1" above, which raise up problems in node 'input0.3' in "NO_OPTIM" tflite file.
from tinyneuralnetwork.
This issue can be reproduced with the following code.
>>> import torch
>>> t = torch.randn(1, 3, 8, 22)
>>> pt = torch.nn.functional.interpolate(t, (15, 43), None, 'nearest')
>>> t_i = t.permute(0, 2,3,1)
>>> import tensorflow as tf
>>> t_o = tf.compat.v1.image.resize_nearest_neighbor(t_i.numpy(), (15, 43), half_pixel_centers=True)
>>> tt = torch.from_numpy(t_o.numpy()).permute(0, 3, 1, 2)
>>> (pt - tt).abs().max()
tensor(5.4481)
>>> (pt - tt).abs().min()
tensor(0.)
>>> torch.nonzero((pt - tt).abs())
tensor([[ 0, 0, 0, 21],
[ 0, 0, 0, 23],
[ 0, 0, 0, 25],
...,
[ 0, 2, 14, 37],
[ 0, 2, 14, 39],
[ 0, 2, 14, 41]])
Surprisingly, by setting half_pixel_centers=False
, the results seem matched. We will take a further look soon.
>>> t_o = tf.compat.v1.image.resize_nearest_neighbor(t_i.numpy(), (15, 43), half_pixel_centers=False)
>>> tt = torch.from_numpy(t_o.numpy()).permute(0, 3, 1, 2)
>>> torch.nonzero((pt - tt).abs())
tensor([], size=(0, 4), dtype=torch.int64)
from tinyneuralnetwork.
@nonononentity Should be fixed via 9e8636a. Would you please try again?
from tinyneuralnetwork.
Thank you. I can't find the details of param half_pixel-centers
in tensorflow's doc. And I find an old blog which said the calculation of resizeNearest would be same as resizeBilinear when half_pixel_center=False
.
In fact, I need to resize a feature map used to detect mono depth. The near objects and far objects are separated in distance in groundtruth. So I think resizeNearest maybe better.
I will try it again with resolution (15, 43) feature map after I integrate these bad code. 23333
from tinyneuralnetwork.
Local experiment results shows the pr fixed the issue at my side, so I will close the issue for now. If it is not the case, please feel free to reopen it by replying to it.
from tinyneuralnetwork.
Related Issues (20)
- Float model failed to convert to TFLite
- [converter] map gather(+reshape) ops with seperate consecutive indices to split(unpack) ops
- tinynn.converter module not found! HOT 2
- [CI] several tests for modifier failed
- Whether to support pytorch to keras HOT 1
- TransposeConv wrong shape? HOT 15
- change input to INT8 after converting to tflite HOT 2
- [converter] implement torch's `aten::scaled_dot_product_attention` operator HOT 2
- Request: clamp would be more efficient to go to Bounded Relu than Maximum + Minimum HOT 3
- Do not support PReLU module? HOT 5
- torch.max not working HOT 2
- OneShotChannelPruner results in the miss of some operators HOT 4
- KeyError when executing quantization HOT 5
- PyTorch 转 TFLite 使用 int8 量化 HOT 4
- Does tinynn support following int16 quantization? HOT 1
- jit.trace succeed but tinynn tracer failed HOT 1
- It became larger after converting to tflite model HOT 4
- how to do Post-training integer quantization with int16 activation HOT 4
- unnecessary float() variables cause quantization to fail. HOT 7
- aten::index nodes take multiple indices in PyTorch model but cause an error when trying to convert to TFLite HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tinyneuralnetwork.