Describe the bug
How can I read a tfci file? I've tried several times, but all attempts result in an error: 'Error during unpacking: Unexpected dtype: '<dtype: 'bool'>'.
To Reproduce
Steps to reproduce the behavior:
Generate the result by running python tfci.py compress hific-lo /data1/wsk/prj/PerCo/res/data/MSCOCO30k/000000410482.jpg, and then proceed to read the output.
System (please complete the following information):
OS linux
Python version [3.11.9]
TensorFlow version [conda install tensorflow=2.14.0]
tensorflow-compression version=2.14.1
Additional context
code
import numpy as np
import tensorflow as tf
import tensorflow_compression as tfc
def convert_bool_to_int(bitstring):
byte_data = np.frombuffer(bitstring, dtype=np.uint8)
converted_data = byte_data
new_bitstring = converted_data.tobytes()
return new_bitstring
def read_tfci_file(tfci_file_path):
with open(tfci_file_path, 'rb') as file:
bitstring = file.read()
bitstring = convert_bool_to_int(bitstring)
packed = tfc.PackedTensors()
try:
packed.unpack(bitstring)
tensors = packed.unpack()
return tensors
except Exception as e:
print(f"Error during unpacking: {e}")
return None
tfci_file_path = '/data1/wsk/prj/hific/models/1_11zon.png.tfci'
tensors = read_tfci_file(tfci_file_path)
if tensors:
for tensor in tensors:
print(tensor)
else:
print("Failed to read tensors.")
Describe the bug How can I read a tfci file? I've tried several times, but all attempts result in an error: 'Error during unpacking: Unexpected dtype: '<dtype: 'bool'>'.
To Reproduce Steps to reproduce the behavior: Generate the result by running python tfci.py compress hific-lo /data1/wsk/prj/PerCo/res/data/MSCOCO30k/000000410482.jpg, and then proceed to read the output.
System (please complete the following information):
Additional context
code