Comments (3)
Hello @Vincouux ,
Thank you for reaching out.
First thing I see is that you don't need to wrap the mean and stddev in the types.Constant
:
# Normalizing (images - mean) / std.
images = dali.fn.normalize(
images,
batch=False,
mean=[0.485, 0.456, 0.406],
stddev=[0.229, 0.224, 0.225]
)
If this doesn't help, could you please post the error message, so I'd know more what's going on?
from dali_backend.
Here is the error I am facing:
Traceback (most recent call last):
File "<string>", line 5, in <module>
File "<frozen importlib._bootstrap>", line 553, in module_from_spec
AttributeError: 'NoneType' object has no attribute 'loader'
Traceback (most recent call last):
File "<string>", line 8, in <module>
File "/opt/tritonserver/backends/dali/conda/envs/dalienv/lib/python3.8/site-packages/nvidia/dali/_utils/autoserialize.py", line 72, in invoke_autoserialize
dali_pipeline().serialize(filename=filename)
File "/opt/tritonserver/backends/dali/conda/envs/dalienv/lib/python3.8/site-packages/nvidia/dali/pipeline.py", line 1471, in create_pipeline
pipe_outputs = func(*args, **fn_kwargs)
File "/models/detection_exp114_20220523_preprocessing/1/dali.py", line 21, in pipe
images = dali.fn.normalize(
File "/opt/tritonserver/backends/dali/conda/envs/dalienv/lib/python3.8/site-packages/nvidia/dali/fn.py", line 88, in fn_wrapper
return op_wrapper(*inputs, **kwargs)
File "/opt/tritonserver/backends/dali/conda/envs/dalienv/lib/python3.8/site-packages/nvidia/dali/fn.py", line 80, in op_wrapper
return op_class(**init_args)(*inputs, **call_args)
File "/opt/tritonserver/backends/dali/conda/envs/dalienv/lib/python3.8/site-packages/nvidia/dali/ops.py", line 621, in __init__
_add_spec_args(self._schema, self._spec, kwargs)
File "/opt/tritonserver/backends/dali/conda/envs/dalienv/lib/python3.8/site-packages/nvidia/dali/ops.py", line 398, in _add_spec_args
converted_value = _type_convert_value(dtype, value)
File "/opt/tritonserver/backends/dali/conda/envs/dalienv/lib/python3.8/site-packages/nvidia/dali/types.py", line 110, in _type_convert_value
return _known_types[dtype][1](val)
TypeError: float() argument must be a string or a number, not 'list'
To give a bit more context, the input image is of shape [-1, -1, 3]. After the resize and the permutation, it should be [3, 224, 224] based on the above pipeline I provided.
Many thanks @szalpal for you help !!!
from dali_backend.
Generally, for image normalization it'd be better if you'd go for fn.crop_mirror_normalize
instead of fn.normalize
. For two reasons, one is that the former fuses 3 possible operations in one and the second is that the API would be more user friendly.
Therefore I'd advice you to use this instead of fn.normalize
:
images = dali.fn.crop_mirror_normalize(images,
dtype=types.FLOAT,
output_layout="CHW",
crop=(224, 224),
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
Should you have any more problems, don't hesitate to reach us out. Good luck in using DALI ;)
Furthermore, if you'd like to squeeze even more perf from this snippet, I'd suggest, that you plug the Rescaling 0-255 to 0-1.
into the normalization by multiplying your normalization parameters by 255
:
mean=[0.485 * 255, 0.456 * 255, 0.406 * 255],
std=[0.229 * 255, 0.224 * 255, 0.225 * 255])
from dali_backend.
Related Issues (20)
- dali backend device parameter setting question HOT 1
- layout parameter to external_source causes assert error HOT 2
- DALI backend not releasing device memory HOT 8
- Error when executing Mixed operator decoders__Image when sending image binary to dali in triton HOT 9
- how to use the numpy data in the DALI HOT 3
- Batching does not improve performance with dali HOT 10
- Can dali backend support default values or optional input? HOT 2
- Unexpected large memory needed for gpu resize HOT 4
- Error in thread 31: nvJPEG error (5): The user-provided allocator functions, for either memory allocation or for releasing the memory, returned a non-zero code. HOT 6
- Cannot compile dali_backend with older version of triton HOT 2
- how to provide batch input data for dali pipeline whicn input shapes [-1] HOT 1
- if I want to crop from different start point, how can I build pipe to do this? HOT 2
- Test issue
- Connecting InputOperator with no explicit inputs to Triton HOT 12
- Could not serialize dali.fn.python_function HOT 1
- when using crop_mirror_normalize func, Output layout "CHW" is slower than "HWC" HOT 5
- dlopen libcuda.so failed!. Please install GPU dirverTraceback (most recent call last): HOT 4
- Prefeed multiple input batches to the inference pipeline HOT 7
- Unable to load numpy module in a DALI backend HOT 3
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 dali_backend.