Comments (4)
Hi @thomas-bouvier,
Thank you for providing more background regarding your use case.
Based on how we understand the ask, this is to make the numpy reader capable of loading files with complex number types, adding a complex type representation to DALI, and reviewing the available operations to see if they should support complex types.
We will evaluate the request and see how it fits our roadmap, in the meantime can you try Python operator on the GPU which can wrap the loading part and the conversion from the complex numbers to the real one, then you can process the data further using the existing DALI operators.
from dali.
Hi @thomas-bouvier,
While technically feasible (still challenging) I'm not sure if we see a good use case for it.
It would be very helpful if you could describe what is the workflow you want to use this feature for.
From the DALI point of view, we would need to create an internal representation (either one tensor that stores this type or two for real and img part) of it and think which operator should support it.
from dali.
Hello @JanuszL, thank you for the feedback (and sorry for the delay).
I understand that this would be an advanced feature, probably not useful to many. Still, let me explain my use case for complex-floating point types.
I am working on xray imaging using diffraction patterns as input data. These diffraction patterns are acquired by a synchrotron light source. A DNN model is used to reconstruct 2 images for every single diffraction pattern : a structure image (amplitude) and a phase image. This is where working with floating point types is needed: the ground-truth data is a collection of numpy arrays containing complex types, from which one can calculate the ground-truth structure and phase above.
As of now, this is how I calculate the ground-truth structure and phase images from the complex numpy arrays rspace_data
(raw ground-truth data):
task_ampli_data = []
task_phase_data = []
for i, _ in enumerate(tqdm(file_paths, desc=f"Loading {len(file_paths)} perspectives")):
# Complex data
rspace_data = np.load(rspace_paths[i])
# Calculating the phase and amplitude from the real-space data
ampli_data = np.abs(rspace_data)
phase_data = np.angle(rspace_data)
# Concatenating scan position(s) for this task
...
task_ampli_data.extend(ampli_data[idx][shard_offset : shard_offset + shard_size])
task_phase_data.extend(phase_data[idx][shard_offset : shard_offset + shard_size])
task_ampli_data = np.array(task_ampli_data, dtype=np.float32)
task_phase_data = np.array(task_phase_data, dtype=np.float32)
taskset = (task_diff_data, task_ampli_data, task_phase_data)
The shape of an individual rspace_data
npy file is 1000x1x256x256, giving ampli_data
and phase_data
of same shapes.
Ideally, I would be able to write the following:
@pipeline_def(batch_size=1, num_threads=1, device_id=device_id)
def input_pipeline():
file_paths = taskset.get_raw_samples()[0]
rspace_paths = [f"{p}/patched_psi.npy" for p in file_paths]
# This npy file contains complex numbers, unfortunately not
# supported by DALI
rspace_data = fn.readers.numpy(
device="gpu",
files=rspace_paths,
shard_id=shard_id,
num_shards=num_shards,
)
Later on, we could leverage abs
and angle
operators to calculate ampli_data
and phase_data
in the pipeline directly.
This is just an idea, your feedback is appreciated :)
from dali.
Thank you for the feedback. Here is an archive containing 5 diffraction patterns patterns.npy.tar.gz.
from dali.
Related Issues (20)
- Segmentation fault when using 'mixed' HOT 5
- Bbox Pruning Too Aggressive? HOT 5
- Indexing video with binary mask HOT 1
- source_info tensor not guaranteed to contain correct data HOT 1
- 16 bit gray scale Image read error HOT 1
- COCO Reader pixelwise_masks Emtpy Output HOT 7
- Dali on Jetson: nvidia.dali.fn.readers.video_resize is missing HOT 4
- Numpy reader test (GDS) HOT 4
- How to add a scalar value to the loader? HOT 1
- Can DALI be integrated into HuggingFace Trainer? HOT 9
- Bug in creating `TensorGPU` when `stream` key is `None` in CUDA array interface HOT 2
- Configure max image size HOT 3
- Webdataset reader behavior with many sources HOT 1
- ModuleNotFoundError: No module named 'nvidia.dali.python_function_plugin' HOT 3
- Speed up Dino with DALI HOT 3
- error using webdataset
- webdataset cannot stop cycling at end of epoch HOT 11
- Get audio data from external data sources and start iteration HOT 7
- Encountered some issues when using mirror flip HOT 2
- Can AArch64 Numba tests be re-renabled? HOT 2
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.