Skip to content
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

Intermittent Process Crash During Bit Loss Testing with RansDecoder (Process finished with exit code -1073741819 (0xC0000005)) #300

Open
huladandandan opened this issue Jul 25, 2024 · 0 comments

Comments

@huladandandan
Copy link

Bug

Description

When testing the model with bit loss using the compressai library, the decoder occasionally crashes and returns error code -1073741819 (0xC0000005). This error does not occur consistently; sometimes the decoding is successful, while other times the error occurs. The testing is performed with the project STF. Below are the relevant code snippets and detailed description.

Expected behavior

-1073741819 (0xC0000005)

my bit loss code:

    error_probability = 0.01  
    corrupted_strings = introduce_bit_loss(out_enc["strings"], error_probability, seed=0)

    # out_dec = model.decompress(out_enc["strings"], out_enc["shape"])
    out_dec = model.decompress(corrupted_strings, out_enc["shape"])

def introduce_bit_loss(data, loss_probability, seed=0):
    """Introduce bit loss into the compressed data."""
    if seed is not None:
        np.random.seed(seed)

    rows = len(data)
    cols = len(data[0]) if rows > 0 else 0
    corrupted_bytes = [[None for _ in range(cols)] for _ in range(rows)]
    corrupted_bytes_temp = []

    for byte_string_list in data:
        original_byte_string = bytearray(byte_string_list[0])

        num_bits = len(original_byte_string)
        num_loss = round(num_bits * loss_probability)
        loss_indices = np.random.choice(num_bits, num_loss, replace=False)

        byte_string_with_loss = original_byte_string.copy()
        for index in loss_indices:
            if 0 <= index < len(byte_string_with_loss):
                byte_string_with_loss[index] = 0

        corrupted_bytes_temp.append(byte_string_with_loss)

    for i in range(rows):
        for j in range(cols):
            corrupted_bytes[i][j] = corrupted_bytes_temp[i]

    return corrupted_bytes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant