soumik12345 / wandb-addons

Weights & Biases Addons is a repository consisting of additional unitilities and community contributions for supercharging your Weights & Biases workflows.
https://geekyrakshit.dev/wandb-addons/
23 stars 7 forks source link

[Feature Request]: Channels-first support for `WandBImageClassificationCallback` #49

Open soumik12345 opened 1 year ago

soumik12345 commented 1 year ago

Request from Ian Stenbit to make the WandBImageClassificationCallback work with both channels-first and channels-last image formats.

mratanusarkar commented 1 year ago

Hi @soumik12345, can I work on this issue?

I figured out that the class WandBImageClassificationCallback exists in the wandb_addons\keras\image_classification.py, and to work with both channels-first and channels-last image formats, we need to ensure that the image tensor is correctly formatted before logging it to WandB.

soumik12345 commented 1 year ago

@mratanusarkar Thanks for your interest. Please feel free to raise a PR.

soumik12345 commented 1 year ago

@mratanusarkar Here are 2 examples to aid your testing:

mratanusarkar commented 1 year ago

@soumik12345 thanks!

mratanusarkar commented 1 year ago

@soumik12345 regarding the channels-first notebook you shared,

Could you please share me a notebook with channels_first image data using the WandBImageClassificationCallback? It would be of great help. thanks!

mratanusarkar commented 1 year ago

@soumik12345 I am unable to test the channels-first pipeline.

I feel WandBImageClassificationCallback callback is designed to work with TensorFlow datasets (tf.data.Dataset) or NumPy arrays (np.array). And not with the PyTorch's DataLoader.

more details Here are some inputs I was using to debug: 1. For channels-last notebook: > Use [this example](https://colab.research.google.com/github/soumik12345/wandb-addons/blob/main/docs/keras/examples/image_classification.ipynb) to test for the channels-last pipeline. - type(test_dataset) --> tensorflow.python.data.ops.prefetch_op._PrefetchDataset - type(config.classes) --> list 2. For channels-first notebook: > Use [this example](https://colab.research.google.com/github/wandb/examples/blob/example/torchvision-keras/colabs/keras/keras_core/torchvision-keras.ipynb) to test for the channels-first pipeline. - type(image_datasets) --> dict - type(image_datasets["val"]) --> torchvision.datasets.folder.ImageFolder - type(class_names) --> list Hence, I believe there was no `WandBImageClassificationCallback` in the channels-first notebook, and hence I made the above conclusion from a little bit of debugging.

I believe this could be a good feature request. As per the current issue, please help me with how I should proceed and close the PR.