Skip to content

Downloading and using LabelImg

Sly Automation edited this page Aug 31, 2022 · 21 revisions

Using screenshot loop to capture screen images for training model

if you need to capture images of the screen for the training model, open and run the script screenshot_loop.py

Make sure to change the settings to suit your needs:

monitor = {"top": 40, "left": 0, "width": 800, "height": 640} # adjust to align with your monitor or screensize that you want to capture

img = 0 # used to determine a count of the images; if starting the loop again make sure to change this number greater than the last saved image e.g below img = 10

image

mob = 'cow' # change to the name of the object/mob to detect and train for.

Run the script, images will be saved under datasets/osrs

image

Download and Install LabelImg

labelImg = https://github.com/heartexlabs/labelImg/releases

Click the link of the latest version for your os (windows or linux), i'm using Windows_v1.8.0.

image

Open downloaded zip file and extract the contents to the desktop or the default user folder.

image

image

Using LabelImg

Open the application lableImg.exe

image

Click on 'Open Dir' and locate the images to be used for training the object detection model.

Also click 'Change Save Dir' and change the folder to the same location, this will ensure the yolo labels are saved in the same place.

image

if using the screenshot_loop.py script change the directory for both 'open Dir' and 'Change Save DIr' to the pycharm directory then to the osrs_yolov5/datasets/osrs folder.

image

Click on the create Rectbox button or use the keyboard shortcut W, type the desired name for the annoted object and click ok.

image

The right section is all the annoted objects with the names and in the lower right section is the path to all the images in the current directory selected.

image