Image Setup - Basics

Images


  • Let’s create a folder to hold our data: /1_datapreparation/data_images
  • Images will be your data, so provide a good minimum of 500 images.
  • Make sure the images are high definitions
  • You can find dataset at PASCAL visual objects classes homepage, sets of images

LabelIMG

Labeling

  • At the beginning all the images have to be labeled manually, in other words, if we are planning on training the model to detect a car we have to go through every picture that contains a car, we need to draw a box around the car and label it as such “car”, if more than one car exist in the image we need to do it for every car
  • In order to do that we need to make sure the venv is activated
  • Use this code
(venv1_yolo) ~\AI\computer_vision\od_projects\1_yolo_ocv_py>labelimg
# an UI will open up which we will use to label all the images
  • Open Dir > find the directory where all the images are > Ok
  • a File list will appear of all the images in the lower right view
  • Set the setting to Pascal/VOC
  • Use create rectangle box for each car
  • Once you stop the box a popup will appear where you enter the label: car….
  • Once done with the image, save it > keep the name of the file as it is prompted and it will save it as .XML file

XML File

  • All the information about the image are saved in the xml which include under <object>
  • name, bndbox which contain the coordinate of the bounding box

  • Of course some images will have more than a car in them, and therefore you’ll have multiple object tags in them
  • So when we extract the information we have to loop through all the object tags
  • So we will need to extract the bounding box and the name of the file, name of object, xmin, ymin, xmax, ymax
  • This information might be needed in the future and to extract it review the page “Extract from XML”