My goal with this project was to see if you could use PNG compression to do decent image classification. I was inspired by a recent paper that used GZip compression and kNN to do sentiment analysis on text. I figured it would be fun to try something like this using Fashion MNIST.
This didn't work very well. On average, there are two categories that half of the labeled sets seem to fall into in terms of compressed length. I didn't do anything with kNN as it would likely not result in much further differentiation given the bimodal homogenous nature of the results. Still, this was a fun experiment.
![Fashion MNIST classified using PNG compression - half of the labels are centered around one compressed size, and half are centered around another. The differentiation is not very clear from these results.](https://private-user-images.githubusercontent.com/7339800/260266151-508b4e51-e38c-4c18-8da7-b95fb2595855.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMyODUzNzYsIm5iZiI6MTcyMzI4NTA3NiwicGF0aCI6Ii83MzM5ODAwLzI2MDI2NjE1MS01MDhiNGU1MS1lMzhjLTRjMTgtOGRhNy1iOTVmYjI1OTU4NTUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MTBUMTAxNzU2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YWMzMGUxZTc4ZWYwZTU2ODhlZjA5MTBmMmIwMDZkNjZkMzNkYzMxM2Q3OTMxZDQ3YWFhNzY3MzU5YTQ2NzRiYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.kCc5Cx8K9OUWH4JnEK7MiK-pbxtlVg-Pkqt-Kwspch8)
For fun, I also tried this with MNIST (code not included, but all you need to do is use the MNIST
dataset identifier from MLDatasets
and use string(k)
for the label since there is no classnames
method for MNIST
data).
![MNIST_PNG](https://private-user-images.githubusercontent.com/7339800/260266198-a33715e1-a9eb-45ae-9406-3284c7658d7e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMyODUzNzYsIm5iZiI6MTcyMzI4NTA3NiwicGF0aCI6Ii83MzM5ODAwLzI2MDI2NjE5OC1hMzM3MTVlMS1hOWViLTQ1YWUtOTQwNi0zMjg0Yzc2NThkN2UucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MTBUMTAxNzU2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NDE0ODE5OWM1YjlmYWE1ZmQ4ZjA5YmVmMGJjNmJkZmEzMTQzYTlmNTdlMTgzOWY4MTI0MDU2ZWVlZGRhMjJlOCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.rEeAOwpt0dNkgapyQNJD8B7IWqVyGCQaPSibr-TWrqE)