libffcv / ffcv

FFCV: Fast Forward Computer Vision (and other ML workloads!)
https://ffcv.io
Apache License 2.0
2.81k stars 180 forks source link

How to work with ByteField? #193

Open Nise-2-meet-U opened 2 years ago

Nise-2-meet-U commented 2 years ago

My training data is not normal BGR images, but a channel stack of multiple images. When I write training data in FFCV format, is it only possible to use ByteField format? After I combined multiple jpeg Bytes files into a 1-dimensional vector, the program reported an error as follow:

Train total img: 0 Train total img: 0 Train total img: 0 Train total img: 7853 Train total img: 7853 Train total img: 7853 Train total img: 15344 0%| | 0/15344 [00:00<?, ?it/s]Process Process-1: Traceback (most recent call last): File "/home/bbs/anaconda3/envs/ffcv/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/home/bbs/anaconda3/envs/ffcv/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/home/bbs/anaconda3/envs/ffcv/lib/python3.8/site-packages/ffcv/writer.py", line 112, in worker_job_indexed_dataset handle_sample(sample, dest_ix, field_names, metadata, allocator, fields) File "/home/bbs/anaconda3/envs/ffcv/lib/python3.8/site-packages/ffcv/writer.py", line 50, in handle_sample field.encode(destination, field_value, allocator.malloc) File "/home/bbs/anaconda3/envs/ffcv/lib/python3.8/site-packages/ffcv/fields/bytes.py", line 68, in encode ptr, buffer = malloc(field.size) AttributeError: 'bytes' object has no attribute 'size'