Package: generate-training-data-ml
Great results without spending a lot of timeThis package generates training data for yolov5 which will save you a lot of time and sanity.
Getting the results that you can see in the video took me about 15 minutes of work and 6 hours of yolov5 training (50,000 images).
So far, I have used the package only for "button like objects" and it has been working well. For more sophisticated objects, you probably need to create the training data manually.pipinstallgenerate-training-data-mlExample -Royale Highfrom Roblox [I had to help out my daughter :) ]Step 1Takea lot ofrandom screenshots (PNG) from the gameWITHOUTany of the buttons you want to find. If you are lazy like me, use frames from YouTube videos:GitHub - hansalemaos/ytframedownloaderStep 2Take some screenshot of the buttons you want to find and save them as shown on the screenshot (PNG).Step 3Downloadhttps://github.com/ultralytics/yolov5to/yolov5/ in your env, install all requirementsStep 4Create a config file that looks like that[GENERAL]image_background_folder="C:\Users\Gamer\anaconda3\envs\dfdir\alltrainingdata"image_button_folder="C:\yolovtest\buttonimages"save_path_generated_pics="C:\trainingset\generated_pics"save_path_generated_pics_separate="C:\trainingset\generated_pics_sep"maximum_buttons_on_pic=3number_of_pictures_to_generate=10000max_overlapping_avoid=50000yaml_file="royal_halloween.yaml"[TRAINING]model_file='yolov5s.yaml'personal_yaml="royal_halloween.yaml"hypfile="hyp.scratch-low.yaml"resolutionsize=640batch=30epochs=4ptfile="C:\Users\Gamer\anaconda3\envs\dfdir\yolov5\yolov5s.pt"workers=4generated_pic_folder="C:\trainingset\generated_pics_sep"name_for_set="royal_halloweennew"save_period=10[BUTTON0]class_name="play_apple_game"allowed_min_distance_from_zero_x=1allowed_min_distance_from_zero_y=1allowed_max_distance_from_zero_x=70allowed_max_distance_from_zero_y=70max_x=25max_y=25min_x=15min_y=15transparency_min=1transparency_max=50max_negativ_rotation=-10max_positiv_rotation=10add_pixelboarder=1add_pixelboarder_percentage=10unsharp_border=1unsharp_border_percentage=10random_crop=1random_crop_percentage=30random_crop_min=0random_crop_max=2random_blur=1random_blur_percentage=20random_blur_min=0.001random_blur_max=0.05[BUTTON1]class_name="won_apples"allowed_min_distance_from_zero_x=1allowed_min_distance_from_zero_y=1allowed_max_distance_from_zero_x=70allowed_max_distance_from_zero_y=70max_x=50max_y=50min_x=40min_y=40transparency_min=1transparency_max=10max_negativ_rotation=-10max_positiv_rotation=10add_pixelboarder=1add_pixelboarder_percentage=10unsharp_border=1unsharp_border_percentage=10random_crop=0random_crop_percentage=30random_crop_min=0random_crop_max=1random_blur=0random_blur_percentage=10random_blur_min=0.001random_blur_max=0.05...Explanation for the config file[GENERAL]image_background_folder-folderwhereyourbackgroundimagesarelocated[GENERAL]image_button_folder-folderwherethebuttonsthatyouwanttodetectarelocated.Eachbuttoncanhaveseveraldifferentimages.Eachbutton's images must be in it'sownfolder.Foldersmustbeconsecutivelynumbered[GENERAL]save_path_generated_pics-Tempfolderforgeneratedfiles[GENERAL]save_path_generated_pics_separate-Finishedgeneratedtrainingdata[GENERAL]maximum_buttons_on_pic-Maxnumberofrandombuttonsonageneratedimage[GENERAL]number_of_pictures_to_generate-Totalnumberoftrainingimages[GENERAL]max_overlapping_avoid-Numberoftimestotrytonotoverlapbuttons(ifmaximum_buttons_on_pic>1)[GENERAL]yaml_file-chooseafilenamewithending'.yaml',e.g.'mygeneratedfiles.yaml'[TRAINING]model_file-Oneofhttps://github.com/ultralytics/yolov5#pretrained-checkpoints  , you might have to download them and put them into the yolov5 folder, maybe they get downloaded automatically[TRAINING]personal_yaml-copywhatyouwrotein[GENERAL]yaml_file[TRAINING]hypfile-Iusuallyuse"hyp.scratch-low.yaml"-checkouttheofficialdocumentation:https://github.com/ultralytics/yolov5[TRAINING]resolutionsize-Use640,Ihaven't tested it with other values[TRAINING]batch-Iuse30withaRTX20608GB[TRAINING]epochs-100isgoodtostartwith-checkouttheofficialdocumentation:https://github.com/ultralytics/yolov5[TRAINING]ptfile-Istartnewmodelswithyolov5s.ptanduselatermyownpretrainedfiles-checkout:https://github.com/ultralytics/yolov5#pretrained-checkpoints[TRAINING]workers-numberofCPUstouse[TRAINING]generated_pic_folder-copywhatyouwrotein[GENERAL]save_path_generated_pics_separate[TRAINING]name_for_set-choosenamefortheset[BUTTON0]-eachbuttonmusthaveitsownsectionnamedBUTTON+nextconsecutivelynumber[BUTTON0]class_name-chooseauniqueclassname[BUTTON0]allowed_min_distance_from_zero_x-theminimumxdistanceinpercentthatthebuttoncanshowuponthepicture[BUTTON0]allowed_min_distance_from_zero_y-theminimumydistanceinpercentthatthebuttoncanshowuponthepicture[BUTTON0]allowed_max_distance_from_zero_x-themaximumxdistanceinpercentthatthebuttoncanshowuponthepicture[BUTTON0]allowed_max_distance_from_zero_y-themaximumydistanceinpercentthatthebuttoncanshowuponthepicture[BUTTON0]max_x-themaxxsizeofthebuttoninpercentrelativetothebackgroundpicture,e.g.ifyouput10andyourimagehasawidthof640,themaxxsizeis64[BUTTON0]max_y-themaxysizeofthebuttoninpercentrelativetothebackgroundpicture[BUTTON0]min_x-theminxsizeofthebuttoninpercentrelativetothebackgroundpicture,e.g.ifyouput10andyourimagehasawidthof640,theminxsizeis64[BUTTON0]min_y-theminysizeofthebuttoninpercentrelativetothebackgroundpicture[BUTTON0]transparency_minforrandomtransparency,valuewillbesubstractedfromalphachannel[BUTTON0]transparency_max-forrandomtransparency,valuewillbesubstractedfromalphachannel[BUTTON0]max_negativ_rotation-degreestorotatebuttonforrandom.randrange[BUTTON0]max_positiv_rotation-degreestorotatebuttonforrandom.randrange[BUTTON0]add_pixelboarder-1toenable,0todisable(forfuzzyborder)[BUTTON0]add_pixelboarder_percentage-percentageofimagestoaddthefuzzyborderto[BUTTON0]unsharp_border-howmanypercentofthepictureshouldbecomeafuzzyborder(minimum)[BUTTON0]unsharp_border_percentage-howmanypercentofthepictureshouldbecomeafuzzyborder(maximum)[BUTTON0]random_crop-1toenable,0todisable,don't disable it for now, might cause problems[BUTTON0]random_crop_percentage-percentageofallimagesthecropshouldbeappliedto[BUTTON0]random_crop_min-howmanypixelsshouldbecropped(minimum)[BUTTON0]random_crop_max-howmanypixelsshouldbecropped(maximum)[BUTTON0]random_blur-1toenable,0todisable[BUTTON0]random_blur_percentage-percentageofallimagestheblurshouldbeappliedto[BUTTON0]random_blur_min-0.001[BUTTON0]random_blur_max-0.005Step 5$pythongenerate_training_data_ml.pyYOURCONFIGFILEResults#If you don't want to use the command line, you can import the modulefromgenerate_training_data_mlimportgenerate_training_datagenerate_training_data(YOURCONFIGFILE)Now you can train the data with yolov5 (I uploaded another package to make your life easier)https://github.com/hansalemaos/train_generated_data_ml