INNER CODE UNIT · Python

colors

davidefiocco/streamlit-fastapi-model-serving · fastapi/segmentation.py:51

    colors = torch.as_tensor([i for i in range(21)])[:, None] * palette
    colors = (colors % 255).numpy().astype("uint8")

    # plot the semantic segmentation predictions of 21 classes in each color
    r = Image.fromarray(output_predictions.byte().cpu().numpy()).resize(
        input_image.size
    )
    r.putpalette(colors)

    return r

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…