Live data from Hacker News

Show HN: Invertornot.com – API to enhance your images in dark-mode

invertornot.com

1–10 of 39 posts

Show HN: Invertornot.com – API to enhance your images in dark-mode

#1
Hi HN, I built (https://invertornot.com) it's an API that can predict whether an image will look good/bad while inverted. This is particularly useful for images in dark-mode as you can now safely invert them.

The conservative solution to adapt images for dark-mode consist in dimming the image, however there is a lot of images that can be inverted (graph for example). Using deep learning we can avoid heuristics and obtain a much more reliable solution.

The API uses an EfficientNet pre-trained model fine-tuned on a custom dataset (1.1k samples). EfficientNet was chosen as it was pre-trained and offered the best performance for its size.

The trained model is very small (16MB) which means you can easily run your own instance. This problem is very simple for deep learning as it's a simple binary classification.

For this project training the model wasn't the challenge as most of the time was spent on the construction of the dataset.

For the API I'm using FastAPI, Redis and ONNX Runtime to run the model. The API can be used by posting the images to the API, using URL and using SHA-1 for already processed images.

The API is free and open-sourced (http://github.com/mattismegevand/invertornot).

Show HN: Invertornot.com – API to enhance your images in dark-mode
invertornot.com

Re: Show HN: Invertornot.com – API to enhance your images in dark-mode

#2
Neat, as a reader, I've absolutely wanted this exact behavior many times. Do you have any examples of incorrectly classified images? As you say, the model seems quite simple, but I wonder if there are some pathological kinds of photographs that result in inversion.

Re: Show HN: Invertornot.com – API to enhance your images in dark-mode

#4
post #3

This is really cool! Do you have some more example images somewhere?

Thank you, yes you can try it directly (https://invertornot.com/docs) or you can either upload an images or spam the button to get random images and see their prediction.

Re: Show HN: Invertornot.com – API to enhance your images in dark-mode

#6

Neat, as a reader, I've absolutely wanted this exact behavior many times. Do you have any examples of incorrectly classified images? As you say, the model seems quite simple, but I wonder if there are some pathological kinds of photographs that result in inversion.

Some graphs with lots of colors can be difficult for models to handle. In these cases, the model often chooses not to flip the graph to avoid making it hard to read, based on past problems with similar graphs. The model generally does a good job at deciding when to flip something. Although I haven't seen it flip photos, it's possible that there are examples out there.

Re: Show HN: Invertornot.com – API to enhance your images in dark-mode

#7
post #5

Very cool! Nice job! Out of curiosity, how much CPU/GPU/RAM resources do you need to allocate to run something like this? Like you mention you're using small models. For example, could this run on a t2.micro on EC2? (1 vCPU + 1GB RAM)

Thank you! Very little resources are needed to run it, gwern is using the API and at first I was using a 6$ Droplet (exact same specs as the t2.micro) and it was running well.

Re: Show HN: Invertornot.com – API to enhance your images in dark-mode

#8
Semi-related - I saw this on https://v8.dev a while back, but `filter: hue-rotate(180deg) invert();` can be a neat CSS trick to 'dark mode' some kinds of graphics, while not screwing with the colours so much. The `hue-rotate` help a bit to keep 'blues blue' etc.

It's far from perfect, but it's a neat one to have in your back pocket.

Post reply on HN