-
Notifications
You must be signed in to change notification settings - Fork 622
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
Runtime error using Numpy readers: Unknown Numpy type c8 #5265
Comments
Hi @thomas-bouvier, While technically feasible (still challenging) I'm not sure if we see a good use case for it. |
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 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 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 This is just an idea, your feedback is appreciated :) |
Hi @thomas-bouvier, Thank you for providing more background regarding your use case. |
Thank you for the feedback. Here is an archive containing 5 diffraction patterns patterns.npy.tar.gz. |
Is this a new feature, an improvement, or a change to existing functionality?
Improvement
How would you describe the priority of this feature request
Must have (e.g. DALI adoption is impossible due to lack in functionality).
Please provide a clear description of problem this feature solves
Hello,
Currently, the numpy reader operator does not support complex-floating point types like
c8
orc16
. This would be a nice addition to load such data from npy files.When loading such a npy file, the following error gets raised
Error in thread 0: [/opt/dali/dali/operators/reader/loader/numpy_loader_gpu.cc:42] [/opt/dali/dali/util/numpy.cc:40] Unknown Numpy type string: c8
:Error is triggered here.
Feature Description
I would like to load
c8
complex types from a npy file.A following request for bool here.
Describe your ideal solution
Ideally, I would like to be able to load this file using a numpy reader.
[I will upload a npy file very soon]
Describe any alternatives you have considered
No response
Additional context
No response
Check for duplicates
The text was updated successfully, but these errors were encountered: