Create a model from images dataset - python

I have a set of images of abstract art classified by artist I want to create a model and generate images by giving the name of an artist. I came across this dataset:
https://github.com/camillegontier/DELAUNAY_dataset/issues
With Stable Diffusion and all that is happening now in early 2023, I want to know your opinion on how to train this dataset and generate new images via the artist's name or by making mixes
For example if I want to make a work in the style of Vasarely or a Mix between Vasarely & Yves Klein ...
I have bases in python, I know https://huggingface.co/, kuggle, stable diffusion but I don't know what is the easiest to achieve this goal
Thanks
I want to generate a new image based on my model

Related

Tensorflow should I crop objects from the images for better accuarcy?

I am new to tensorflow and I could not find an answer for my question.
I am trying to make a simple program what recognises the type of van from the picture. I downloaded about 100 pictures for my dataset from each category.
My question is should I crop the pictures so only the van is visible on the picture?
Or should I use the original picture with the background for better accuracy?
The short answer is yes it will, but there is a lot more to consider when asking that question. For example, when I use this model how will the images look? Will there be someone to manually crop these images and then use the model or will someone be taking these photos off of a cell phone using an app? A core concept of Machine learning is to have the images in the production environment as close to the training data as possible so that your performance in production doesn't change.
If you're just trying to learn I would highly recommend trying to build a network on MNIST or lego bricks dataset before you try on your own images as if you get stuck on either there are a lot of great resources available :). Also, consider setting aside 10 images as a Test set so that you can evaluate model performance. And third, Tensorflow has a built-in image dataset generator which will greatly improve your model performance on a small dataset like this. The TensorFlow image dataset generator can scale, rotate, flip and, zoom your images which will produce huge improvements in model accuracy.
Good luck!

Keras - Image Classification with two classes Tensorflow Python

i want to classify two classes with CNN.
first class are objects(car, building, and so go an)
secound class are NoObjects(for example Background without objects)
So, the question is, how can I realize this? I want to have many objects images for the CNN. I saw a example with Cat and Dog.. But I have only images for one class. The other class are the background. It is possible to create a background class??
I´m very new in CNN..
It seems that you're talking about semantic segmentation, where you have a variable N number of classes to localize (in this case N=1) plus the background class. There's a lot of literature and baseline models out there that can help you out. I recommend these two since they're the most popular ones:
Pretrained models: Tensorflow's model zoo
Datasets: Specifically COCO

Is it possible to train model from multiple datasets for each class?

I'm pretty new to object detection. I'm using tensorflow object detection API and I'm now collecting datasets for my project
and model_main.py to train my model.
I have found and transformed two quite large datasets of cars and traffic lights with annotations. And made two tfrecords from them.
Now I want to train a pretrained model however, I'm just curious will it work? When it is possible that an image for example "001.jpg" will have of course some annotated bounding boxes of cars (it is from the car dataset) but if there is a traffic light as well it wouldn't be annotated -> will it lead to bad learning rate? (there can be many of theese "problematic" images) How should I improve this? Is there any workaround? (I really don't want to annotate the images again)
If its stupid question I'm sorry, thanks for any response - some links with this problematic would be the best !
Thanks !
The short answer is yes, it might be problematic, but with some effort you can make it possible.
If you have two urban datasets, and in one you only have annotations for traffic lights, and in the second you only have annotations for cars, then each instance of car in the first dataset will be learned as false example, and each instance of traffic light in the second dataset will be learned as false example.
The two possible outcomes I can think of are:
The model will not converge, since it tries to learn opposite things.
The model will converge, but will be domain specific. This means that the model will only detect traffic lights on images from the domain of the first dataset, and cars on the second.
In fact I tried doing so myself in a different setup, and got this outcome.
In order to be able to learn your objective of learning traffic lights and cars no matter which dataset they come from, you'll need to modify your loss function. You need to tell the loss function from which dataset each image comes from, and then only compute the loss on the corresponding classes (/zero out the loss on the classes do not correspond to it). So returning to our example, you only compute loss and backpropagate traffic lights on the first dataset, and cars on the second.
For completeness I will add that if resources are available, then the better option is to annotate all the classes on all datasets in order to avoid the suggested modification, since by only backpropagating certain classes, you do not enjoy using actual false examples for other classes.

Racecar image tagging

I am working on a system to simplify our image library which grows anywhere from 7k to 20k new pictures per week. The specific application is identifying which race cars are in pictures (all cars are similar shapes with different paint schemes). I plan to use python and tensorflow for this portion of the project.
My initial thought was to use image classification to classify the image by car; however, there is a very high probability of the picture containing multiple cars. My next thought is to use object detection to detect the car numbers (present in fixed location on all cars [nose, tail, both doors, and roof] and consistent font week to week). Lastly there is the approach of object recognition of the whole car. This, on the surface, seems to be the most practical; however, the paint schemes change enough that it may not be.
Which approach will give me the best results? I have pulled a large number of images out for training, and obviously the different methods require very different training datasets.
The best approach would be to use all 3 methods as an ensamble. You train all 3 of those models, and pass the input image to all 3 of them. Then, there are several ways how you can evaluate output.
You can sum up the probabilities for all of the classes for all 3 models and then draw a conclusion based on the highest probability.
You can get prediction from every model and decide based on number of votes: 1. model - class1, 2. model - class2, 3. model - class2 ==> class2
You can do something like weighted decision making. So, let's say that first model is the best and the most robust one but you don't trust it 100% and want to see what other models will say. Than you can weight the output of the first model with 0.6, and output of other two models with weight of 0.2.
I hope this helps :)

Train Python Object Detection Model Strait Object's Images

as the title states, is there a way to build a object detection model (with a library pytorch or tensorflow) that trains straight from the objects picture. Here's an example. This is the inputted image.
(A Clash Royale Battle Scene)
And say that I wanted it to detect a troop (Let's say the valkyrie with orange hair). I could train it with how you'd normally train it (put a box around it) and do a bunch of examples, but is there a way that I could just give it the valkyrie image (below)
And train it on that. For my situation, this will be much easier. Also I know that I said tensorflow before, but if possible I'd like not to use it as I have a 32bit system. Any help is greatly appreciated.

Categories