image processing taken from unreal engine using unreal cv for machine learning task
The goal of this project is to develop a system which will be used in a retailer shop to count and filling objects from the shell. The project is conducting by Institute for Artificial Intelligence. Ideas and developed steps are discussed below.
The goal of this part is to develop a system which will be capable of capturing image of object which isimported as an actor in UE4. A brief introduction about instaling UE4, UnrealCV and basics of the codeis available here.
Full code is available here.
Step by step the working method of the automated image capturing tool is described below.
After running the main.py for one actoar at a time RGB image, mask image, normal image, ROI(ina text file) and Mask Image information(1 text file for one actor) are saved.
Things to remind —
In the config file all minimal info has given which will control how to take the image like polar, azimuthal angle, viewmode of UE4, image type etc. Pay attention here, to give minus/negative sign before the step of polar angle.
vget /objects
After performing the above task the output folder structure will be as follows —
Sample image and ROI file is linked below
This section will show the method of using YOLO for detecting object from the Image and Video. It will cover the top to bottom process of making data-set using YOLO and the way to use them like trainingand testing.To know about the theory of the YOLO this paper & this link will be a good one to start.
\
Training with YOLO can be divided into two parts. First one is to convert dataset for YOLO processand the later will stand for the training.
Dataset for YOLO
To convert dataset for YOLO means to make dataset containing the ROI(region of interest) informationwith class number. A structured repository for this operation could be found here. In this repository two folders and one file is most important and they are as follows:
Here, Images folder keep all of the RGB images with sub-folder(sub-folder means the folder which will contains images of different class. Naming of folders could be anything eg. class name). In the Labels folder keep the sub-folders which contains all the ROI information of actors in each image. Inside of the Labels folder a destination folder named out should be created where the converted YOLO format file is saved. Reason of using convert.py file is to generate files in YOLO format. I have modified the convert.py file and it would be found here.
The contents of the out folder (text files with ROI information) and the Images folder would be placed in a folder named obj in the darknet/data/directory. This darknet folder is nothing but a git repository which is also mentioned in this link. During putting all of the images and text file don’t use any sub-directory. Direct put all of the contents.\
Another two files named obj.names and obj.data these two files also be placed in the darknet/data/directory. \
Content of obj.data is like as the following lines -\
classes= 19\
train = data/train.txt\
valid = data/test.txt\
names = data/obj.names\
backup = backup/
Description of these lines are -
In darknet/cfg/ directory yolo-obj.cfg file would be placed. It is the configuration file to train.
Some points to be noted during use of this file are listed below :
filters= (num/3)∗(classes+ 5)
./darknet detector train data/obj.data cfg/yolo-obj.cfg darknet53.conv.743*
. ./darknet detector traindata/obj.data cfg/yolo-obj.cfg backup/xyzweights
../darknet detector test data/obj.data cfg/yolo-obj.cfg backup/yolo-obj1200.weightsdata/testimage.jpg -out testoutput
.This process can identify object with proper classification where input image will contain only the object except the surroundings which can be addressed as also as cropped image. These cropped image is generated with this code. To do the process training and testing file could be listed in a csv file which can be done using this code. To initiate training this code can be used. During training one can do image augmentation using built-in library, details would be found here here.