<jupyter_start><jupyter_text>The extra data we are using for pseudo labeling contains both RGB and grayscale images. To deal with that, we used this simple trick suggested by `ptrblck` ([link](https://discuss.pytorch.org/t/input-3-and-1-channel-input-to-the-network-in-pytorch/18519/2)). ![image.png](attachment:e4894eab-3ac9-4bcb-8543-7fc3fcb1f2b7.png)<jupyter_code>from PIL import Image
import numpy as np<jupyter_output><empty_output><jupyter_text>When converted to an array or tensor, RGB images have shape (h, w, c), where c=3.<jupyter_code>img = Image.open('../data/extra/6231ed9b3-1.jpg').convert('RGB')
print(np.array(img).shape)
img<jupyter_output>(233, 399, 3)<jupyter_text>Grayscale images, however, have shape (h, w).<jupyter_code>img = Image.open('../data/extra/6231ed9b3-9.jpg')
print(np.array(img).shape)
img<jupyter_output>(281, 400)<jupyter_text>Using `ptrblck`'s trick, however, we can convert grayscale images to RGB, which have (h, w, c) shape.<jupyter_code>img = Image.open('../data/extra/6231ed9b3-9.jpg').convert('RGB')
print(np.array(img).shape)
img<jupyter_output>(281, 400, 3)
{'fraction_non_alphanumeric': 0.1569872958257713, 'fraction_numerical': 0.05989110707803993, 'mean_word_length': 6.304635761589404, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '139023', 'license': 'MIT', 'n_tokens_mistral': 469, 'n_tokens_neox': 429, 'n_words': 87, 'path': 'nbs/grayscale_to_rgb.ipynb', 'repo_name': 'IamGianluca/petfinder-pawpularity-score', 'size': '1102'}