google-research / deeplab2

DeepLab2 is a TensorFlow library for deep labeling, aiming to provide a unified and state-of-the-art TensorFlow codebase for dense pixel labeling tasks.
Apache License 2.0
1k stars 159 forks source link

How do I visualize the kMaX results? #131

Open abaybektursun opened 2 years ago

abaybektursun commented 2 years ago

Hi! New to DeepLab. I am trying to run an visualize kMaX results. I tried to adapt the DeepLab_Demo notebook, I tried the store_raw_predictions but I only get black images and one grey-scale silhouette. Here how I setup the model:

txtproto = "kmax_resnet50_coco_train/kmax_meta_r50_os32.textproto"

def _read_proto_file(filename, proto):
    filename = filename  # OSS: removed internal filename loading.
    with tf.io.gfile.GFile(filename, 'r') as proto_file:
        return text_format.ParseLines(proto_file, proto)

config = _read_proto_file(txtproto, config_pb2.ExperimentOptions())
kMaX = kmax_deeplab.KMaXDeepLab(config, dataset.COCO_PANOPTIC_INFORMATION)

response = requests.get("https://img.freepik.com/free-photo/stunning-curly-female-model-jumping-purple-indoor-portrait-slim-girl-bright-yellow-dress_197531-10836.jpg?w=1380&t=st=1662671803~exp=1662672403~hmac=c7434899117f915fa44ea5f6f181f849dce90fa700f3f9e2b5314d3157514b43")
img = np.expand_dims(np.array( Image.open(BytesIO(response.content)) ), axis=0)
pred = kMaX.call(img)
aquariusjay commented 2 years ago

Hi @abaybektursun,

Thanks for bringing up the issue. We are working on a new DeepLab_demo.ipynb, using kMaX-DeepLab checkpoints. Please stay tuned.

Cheers,

aquariusjay commented 2 years ago

Hi @abaybektursun,

To keep you updated, we have just open-sourced a new ipynb demo using kMaX-DeepLab checkpoints. You may want to take a look.

Cheers,