Submitted by PegasusInvasion t3_yz7dig in MachineLearning

Are there any pre-trained machine learning models out there that can detect any object in an image without me having to train them first?

I come across a few object detection libraries that require me to train it to a date set. Then it will only be able to detect the presence of those objects.

I want a machine learning model where I can feed is any image and it returns me name of objects present in that image. I need it for one of my projects.

Any help will be appreciated.

Thanks!

1

Comments

You must log in or register to comment.

IntelligenXia t1_iwyyhyn wrote

Detectron2 ( Facebook ) or for ease of use - Yolo v5 onwards

eg : For Yolo v5 based on how complex you want your inference to run, change the yaml file .

Here coco.yaml has around 80 objects

The model on Imagenet has around 1000 classes . That should be more than enough for anything you want to do !

Here are the 80 classes from coco.yaml file

0: person 1: bicycle 2: car 3: motorcycle 4: airplane 5: bus 6: train 7: truck 8: boat 9: traffic light 10: fire hydrant 11: stop sign 12: parking meter 13: bench 14: bird 15: cat 16: dog 17: horse 18: sheep 19: cow 20: elephant 21: bear 22: zebra 23: giraffe 24: backpack 25: umbrella 26: handbag 27: tie 28: suitcase 29: frisbee 30: skis 31: snowboard 32: sports ball 33: kite 34: baseball bat 35: baseball glove 36: skateboard 37: surfboard 38: tennis racket 39: bottle 40: wine glass 41: cup 42: fork 43: knife 44: spoon 45: bowl 46: banana 47: apple 48: sandwich 49: orange 50: broccoli 51: carrot 52: hot dog 53: pizza 54: donut 55: cake 56: chair 57: couch 58: potted plant 59: bed 60: dining table 61: toilet 62: tv 63: laptop 64: mouse 65: remote 66: keyboard 67: cell phone 68: microwave 69: oven 70: toaster 71: sink 72: refrigerator 73: book 74: clock 75: vase 76: scissors 77: teddy bear 78: hair drier 79: toothbrush

​

A slight change in the inference code is to needed to write into a csv file , in your case

Photo 1 | Car |

Photo 2 | Car | Person

...

etc

2

skaag t1_iwyntwj wrote

Check out YOLO

1

blimpyway t1_iwz31ut wrote

And how would an image without any object look like?

1

smsorin t1_iwygv07 wrote

No, and if there was one you wouldn't want it.

The reason is that with a model, any model, you only get guarantees for inputs that match the training data distribution. If the model has never seen a cogwheel before there's no telling what it will do.

If you find one, there's no promise how well it will do on your task. It might work, might work but only half the time or it might just give you wrong answers. To know this, you will need a dataset with your images and the desired labels. If you have this, you might as well make it a bit larger and train the model on part of it.

You will get better results if you start from a model that already was trained on data similar to your, or start with a pretrained model and tune it on your data.

−2

PegasusInvasion OP t1_iwyhe5f wrote

Thanks for the explanation.

I actually wanted to use a machine learning model to sort my pictures folder based on the objects in the image.

For example, I have 10 images of cars and 5 images of buildings. I wanted to move images of cars and buildings into separate folders.

Do you have any idea, how I can achieve that?

2

sudhanv99 t1_iwyhvfj wrote

it is doable but you have to know what images are in your folder. you can find models trained on coco dataset which can do this. but your images have to be in the coco dataset.

you can write a script which will move your files based on the predictions after that.

1

PegasusInvasion OP t1_iwyj8hb wrote

I was trying to avoid having to train on a coco dataset 🫤 Anyway, thanks for your help!

1

sudhanv99 t1_iwyjd7e wrote

you dont have to train. there are pretrained models, you can just run inference.

4

PegasusInvasion OP t1_iwyjhlh wrote

Sorry I misunderstood what you meant by coco dataset. I get it now. Do you know any good models that I can try?

1