Back
Content & Media Generation

GENERATIVE AI

Author
pfactorial
July 01, 2024
Share
Resolution
Human beings are good at creating new things from what they have learned.What if an AI model can do this!Yes now it is possible for an AI model to write poems,stories,generate images based on a text prompt.This type of AI models are known as generative ai models.For instance let us consider an example of Generative adversarial neural networks(GANs).These models contains two parts, a generator and a discriminator.
During training the generator creates fake images and the job of discriminator is to identify whether the image created by the generator is fake or real.Throughout the training process the generator learns to outsmart the discriminator by generating images  that look like real images. After training the model is able to generate images that look like real images.
Super resolution
google AI amazing image enhancement

GANs can be used to increase the resolution of low resolution images.One of the models that can be used for increasing the image resolution is SRGAN (Super resolution Generative Adversarial networks).Its architecture consists of two parts,a  generator  network and  a discriminator network.The generator network takes low resolution images as input and aims to output High resolution images.The discriminator’s job is to distinguish between the real high resolution images and the high resolution image generated by the generator.

The generator increases the resolution of the low resolution input images by 4 times.The discriminator has the original high resolution image .When the super resolution image generated by the generator reaches the discriminator ,the discriminator classifies it into Real high resolution image or the image generated by the generator.Then based on this feedback the generator improves itself to trick the discriminator in believing that the image generated by generator is an original image.At the end of the training process the generator becomes so good that it can generate good high resolution images that resembles the original ones.
Generator loss


When and Why?
If you have an old family photo and want to enhance its clarity ,you might consider software like photoshop or some other image editing tool.However ,manual editing is required when using these softwares. Instead , you can use an AI model like SRGAN to enhance the quality of the old image automatically. You don’t have to do anything,just pass the image to the model and the model will automatically increase the quality of the image.

Now,consider another scenario where a bank has been robbed, and the CCTV footage is of poor quality.So it is hard for the police to identify the culprits.To identify the culprits superresolution techniques can be applied on the video frames for a better clarity video.
Creating your own Super resolution API
Let us create our own super resolution api using the model RealESRGAN

Flask API
The model upscales the low quality image by 4 times.
We are using flask api to create an api for calling the model.
When the program runs for the first time the weights of the model will be saved in the weights folder.The model uses these weights for converting the image to super resolution image.
Sending an image to the model and saving the super resolution image returned by the model
Example :
Original image to Super resolution image

Resolution correction
Benefits
  • Document  preservation - Generative super resolution techniques can preserve old documents by increasing their clarity in digital form.
  • Memory management - Storing a video or image as low resolution and convert it to high resolution using super resolution techniques when required
  • Scientific research - In fields such as astronomy super resolution can be used to enhance the quality of astronomical images.
  • Content creation - Content creators can use Super resolution technologies to enhance their low quality videos.
Challenges
  • Privacy - Recently, there has been a surge in image enhancement apps.Anyone can enhance their images using these apps.But when using personal images for enhancement it is a matter of concern .This concern arises from the possibility that the company behind the app may have non-ethical motives
  • Document forgery - Super resolution techniques can be used to enhance the clarity of signatures from document images and use the signature for illegal activities.
  • Data availability - Large amounts of data is required to train a Super  resolution GAN.It is not always possible  to gather that much amount of image data.
Use Cases
  • Super resolution using SRGAN can be used for increasing the quality of images for optical character recognition(OCR).
  • Super resolution techniques can be used in medical imaging to enhance the quality of medical images .
  • Satellite imagery - To increase the clarity of satellite images super resolution can be used.
  • Image restoration  - Super resolution can be used to enhance the clarity of old images
  • Criminal investigation - Using super resolution to enhance the footages related to criminal activities can help in the identification of suspects.
DISCOVER MORE. CONNECT WITH US!

Intrigued by what you have read? Dive deeper and stay ahead with the latest insights and trends. We are here to answer your questions and help you explore further.