diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..fc56c613
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+# Temporary files
+.DS_Store
+.Trashes
+.Spotlight-V100
+*.swp
+*.lock
+.DS_Store
diff --git a/ProcessImages.workflow/Contents/Info.plist b/ProcessImages.workflow/Contents/Info.plist
new file mode 100644
index 00000000..db6de059
--- /dev/null
+++ b/ProcessImages.workflow/Contents/Info.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ CFBundleName
+ ProcessImages
+
+
diff --git a/ProcessImages.workflow/Contents/QuickLook/Preview.png b/ProcessImages.workflow/Contents/QuickLook/Preview.png
new file mode 100644
index 00000000..9f9f9a60
Binary files /dev/null and b/ProcessImages.workflow/Contents/QuickLook/Preview.png differ
diff --git a/ProcessImages.workflow/Contents/document.wflow b/ProcessImages.workflow/Contents/document.wflow
new file mode 100644
index 00000000..ca685f95
--- /dev/null
+++ b/ProcessImages.workflow/Contents/document.wflow
@@ -0,0 +1,883 @@
+
+
+
+
+ AMApplicationBuild
+ 428
+ AMApplicationVersion
+ 2.7
+ AMDocumentVersion
+ 2
+ actions
+
+
+ action
+
+ AMAccepts
+
+ Container
+ List
+ Optional
+
+ Types
+
+ com.apple.cocoa.path
+
+
+ AMActionVersion
+ 1.1.2
+ AMApplication
+
+ Finder
+
+ AMParameterProperties
+
+ fileNames
+
+
+ AMProvides
+
+ Container
+ List
+ Types
+
+ com.apple.cocoa.path
+
+
+ ActionBundlePath
+ /System/Library/Automator/Get Specified Finder Items.action
+ ActionName
+ Get Specified Finder Items
+ ActionParameters
+
+ fileNames
+
+
+ BundleIdentifier
+ com.apple.Automator.SpecifiedFiles
+ CFBundleVersion
+ 1.1.2
+ CanShowSelectedItemsWhenRun
+
+ CanShowWhenRun
+
+ Category
+
+ AMCategoryFilesAndFolders
+
+ Class Name
+ SpecifiedFilesAction
+ InputUUID
+ AF4C6353-1C19-462B-B67E-5B15BE7E9D6C
+ Keywords
+
+ File
+ Choose
+ Find
+ Get
+
+ OutputUUID
+ 9277BC7F-F5F4-4D54-BC78-F3971EA236D9
+ UUID
+ D53523DA-0107-41B1-AF26-994C959D0368
+ UnlocalizedApplications
+
+ Finder
+
+ arguments
+
+ 0
+
+ default value
+
+ name
+ fileNames
+ required
+ 0
+ type
+ 0
+ uuid
+ 0
+
+
+ conversionLabel
+ 0
+ isViewVisible
+
+ location
+ 248.500000:240.000000
+ nibPath
+ /System/Library/Automator/Get Specified Finder Items.action/Contents/Resources/Base.lproj/main.nib
+
+ isViewVisible
+
+
+
+ action
+
+ AMAccepts
+
+ Container
+ List
+ Optional
+
+ Types
+
+ com.apple.cocoa.path
+
+
+ AMActionVersion
+ 1.1.1
+ AMApplication
+
+ Preview
+
+ AMParameterProperties
+
+ imageType
+
+
+ AMProvides
+
+ Container
+ List
+ Types
+
+ com.apple.cocoa.path
+
+
+ ActionBundlePath
+ /System/Library/Automator/Change Type of Images.action
+ ActionName
+ Change Type of Images
+ ActionParameters
+
+ imageType
+ JPEG
+
+ BundleIdentifier
+ com.apple.Automator.ChangeImageType
+ CFBundleVersion
+ 1.1.1
+ CanShowSelectedItemsWhenRun
+
+ CanShowWhenRun
+
+ Category
+
+ AMCategoryPhotos
+
+ Class Name
+ AMChangeImageTypeAction
+ InputUUID
+ FC8B21C7-55C1-4204-B8B9-26CEEEA89C8E
+ Keywords
+
+ Image
+ Photo
+ Change
+ Convert
+ Set
+
+ OutputUUID
+ 4B97901B-6870-4536-AAB0-3DB1EED74748
+ UUID
+ 0BEC556E-EA09-484A-9F98-8FB2E335ABA3
+ UnlocalizedApplications
+
+ Preview
+
+ arguments
+
+ 0
+
+ default value
+ TIFF
+ name
+ imageType
+ required
+ 0
+ type
+ 0
+ uuid
+ 0
+
+
+ conversionLabel
+ 0
+ isViewVisible
+
+ location
+ 248.500000:396.000000
+ nibPath
+ /System/Library/Automator/Change Type of Images.action/Contents/Resources/Base.lproj/main.nib
+
+ isViewVisible
+
+
+
+ action
+
+ AMAccepts
+
+ Container
+ List
+ Optional
+
+ Types
+
+ com.apple.cocoa.path
+
+
+ AMActionVersion
+ 1.3.2
+ AMApplication
+
+ Finder
+
+ AMParameterProperties
+
+ caseIndicator
+
+ dateFormat
+
+ datePlacement
+
+ dateSeparator
+
+ dateToUse
+
+ defaultName
+
+ ignoreCase
+
+ includeExtensions
+
+ insertionPosition
+
+ minimumCount
+
+ nameDateSeparator
+
+ nameSingleItem
+
+ numberLocation
+
+ numberSeparator
+
+ renameItems
+
+ renameType
+
+ replaceWithText
+
+ tokenizedValue
+
+ JPEG
+
+
+ singleItemOption
+
+ startingNumber
+
+ textInput
+
+ textToFind
+
+ tokenizedValue
+
+ jpg
+
+
+ useLeadingZeros
+
+
+ AMProvides
+
+ Container
+ List
+ Types
+
+ com.apple.cocoa.path
+
+
+ ActionBundlePath
+ /System/Library/Automator/Rename Finder Items.action
+ ActionName
+ Rename Finder Items: Replace Text
+ ActionParameters
+
+ caseIndicator
+ 1
+ dateFormat
+ 0
+ datePlacement
+ 0
+ dateSeparator
+ 0
+ dateToUse
+ 0
+ defaultName
+
+ ignoreCase
+
+ includeExtensions
+ 2
+ insertionPosition
+ 0
+ minimumCount
+ 2
+ nameDateSeparator
+ 0
+ nameSingleItem
+
+ numberLocation
+ 0
+ numberSeparator
+ 0
+ renameItems
+ 0
+ renameType
+ 4
+ replaceWithText
+ JPEG
+ singleItemOption
+ 0
+ startingNumber
+ 1
+ textInput
+
+ textToFind
+ jpg
+ useLeadingZeros
+
+
+ BundleIdentifier
+ com.apple.Automator.AddNumbersToFinderNames
+ CFBundleVersion
+ 1.3.2
+ CanShowSelectedItemsWhenRun
+
+ CanShowWhenRun
+
+ Category
+
+ AMCategoryFilesAndFolders
+
+ Class Name
+ AMRenameFinderItemsAction
+ InputUUID
+ 0F0A06E4-66E7-4BB4-9AB8-A39840CC8096
+ Keywords
+
+ Name
+ File
+ Folder
+ Add
+ Number
+ Change
+ Case
+ Rename
+ Date
+ Time
+ Set
+ Text
+ Find
+ Replace
+ Make
+ Sequential
+
+ OutputUUID
+ EE13DDA9-3F45-43D5-B6DC-88C9C050AFE3
+ UUID
+ 95701AB7-EBB4-4546-88D7-6C79AC3ECE4A
+ UnlocalizedApplications
+
+ Finder
+
+ arguments
+
+ 0
+
+ default value
+ 0
+ name
+ nameDateSeparator
+ required
+ 0
+ type
+ 0
+ uuid
+ 0
+
+ 1
+
+ default value
+
+ name
+ textToFind
+ required
+ 0
+ type
+ 0
+ uuid
+ 1
+
+ 10
+
+ default value
+
+ name
+ nameSingleItem
+ required
+ 0
+ type
+ 0
+ uuid
+ 10
+
+ 11
+
+ default value
+
+ name
+ ignoreCase
+ required
+ 0
+ type
+ 0
+ uuid
+ 11
+
+ 12
+
+ default value
+
+ name
+ textInput
+ required
+ 0
+ type
+ 0
+ uuid
+ 12
+
+ 13
+
+ default value
+ 0
+ name
+ dateToUse
+ required
+ 0
+ type
+ 0
+ uuid
+ 13
+
+ 14
+
+ default value
+ 0
+ name
+ includeExtensions
+ required
+ 0
+ type
+ 0
+ uuid
+ 14
+
+ 15
+
+ default value
+
+ name
+ replaceWithText
+ required
+ 0
+ type
+ 0
+ uuid
+ 15
+
+ 16
+
+ default value
+ 0
+ name
+ renameItems
+ required
+ 0
+ type
+ 0
+ uuid
+ 16
+
+ 17
+
+ default value
+
+ name
+ defaultName
+ required
+ 0
+ type
+ 0
+ uuid
+ 17
+
+ 18
+
+ default value
+ 1
+ name
+ startingNumber
+ required
+ 0
+ type
+ 0
+ uuid
+ 18
+
+ 19
+
+ default value
+ 0
+ name
+ numberSeparator
+ required
+ 0
+ type
+ 0
+ uuid
+ 19
+
+ 2
+
+ default value
+ 0
+ name
+ datePlacement
+ required
+ 0
+ type
+ 0
+ uuid
+ 2
+
+ 20
+
+ default value
+ 0
+ name
+ caseIndicator
+ required
+ 0
+ type
+ 0
+ uuid
+ 20
+
+ 21
+
+ default value
+ 0
+ name
+ dateFormat
+ required
+ 0
+ type
+ 0
+ uuid
+ 21
+
+ 3
+
+ default value
+ 0
+ name
+ insertionPosition
+ required
+ 0
+ type
+ 0
+ uuid
+ 3
+
+ 4
+
+ default value
+ 0
+ name
+ dateSeparator
+ required
+ 0
+ type
+ 0
+ uuid
+ 4
+
+ 5
+
+ default value
+ 2
+ name
+ minimumCount
+ required
+ 0
+ type
+ 0
+ uuid
+ 5
+
+ 6
+
+ default value
+ 0
+ name
+ numberLocation
+ required
+ 0
+ type
+ 0
+ uuid
+ 6
+
+ 7
+
+ default value
+
+ name
+ useLeadingZeros
+ required
+ 0
+ type
+ 0
+ uuid
+ 7
+
+ 8
+
+ default value
+ 0
+ name
+ singleItemOption
+ required
+ 0
+ type
+ 0
+ uuid
+ 8
+
+ 9
+
+ default value
+ 0
+ name
+ renameType
+ required
+ 0
+ type
+ 0
+ uuid
+ 9
+
+
+ conversionLabel
+ 0
+ isViewVisible
+
+ location
+ 248.500000:636.000000
+ nibPath
+ /System/Library/Automator/Rename Finder Items.action/Contents/Resources/Base.lproj/main.nib
+
+ isViewVisible
+
+
+
+ action
+
+ AMAccepts
+
+ Container
+ List
+ Optional
+
+ Types
+
+ com.apple.cocoa.path
+
+
+ AMActionVersion
+ 1.3.1
+ AMApplication
+
+ Preview
+
+ AMParameterProperties
+
+ percentageValue
+
+ scaleMethod
+
+ scaleValue
+
+ sizeValue
+
+
+ AMProvides
+
+ Container
+ List
+ Types
+
+ com.apple.cocoa.path
+
+
+ ActionBundlePath
+ /System/Library/Automator/Scale Images.action
+ ActionName
+ Scale Images
+ ActionParameters
+
+ percentageValue
+ 100
+ scaleMethod
+ 0
+ scaleValue
+ 0
+ sizeValue
+ 320
+
+ BundleIdentifier
+ com.apple.Automator.ScaleImage
+ CFBundleVersion
+ 1.3.1
+ CanShowSelectedItemsWhenRun
+
+ CanShowWhenRun
+
+ Category
+
+ AMCategoryPhotos
+
+ Class Name
+ AMScaleImagesAction
+ InputUUID
+ C757196A-0313-4C60-8046-585D5A4B6985
+ Keywords
+
+ Image
+ Photo
+ Scale
+ Change
+
+ OutputUUID
+ ED979F23-13E2-483F-B523-C5554A5EE9B3
+ UUID
+ 29DDFD30-12AE-460D-BDE1-C7F96075940B
+ UnlocalizedApplications
+
+ Preview
+
+ arguments
+
+ 0
+
+ default value
+ 100
+ name
+ percentageValue
+ required
+ 0
+ type
+ 0
+ uuid
+ 0
+
+ 1
+
+ default value
+ 0
+ name
+ scaleValue
+ required
+ 0
+ type
+ 0
+ uuid
+ 1
+
+ 2
+
+ default value
+ 0
+ name
+ scaleMethod
+ required
+ 0
+ type
+ 0
+ uuid
+ 2
+
+ 3
+
+ default value
+ 480
+ name
+ sizeValue
+ required
+ 0
+ type
+ 0
+ uuid
+ 3
+
+
+ conversionLabel
+ 0
+ isViewVisible
+
+ location
+ 248.500000:741.000000
+ nibPath
+ /System/Library/Automator/Scale Images.action/Contents/Resources/Base.lproj/main.nib
+
+ isViewVisible
+
+
+
+ connectors
+
+ 9156CD08-BE78-40A2-A343-11EF5D6803A6
+
+ from
+ 0BEC556E-EA09-484A-9F98-8FB2E335ABA3 - 0BEC556E-EA09-484A-9F98-8FB2E335ABA3
+ to
+ 95701AB7-EBB4-4546-88D7-6C79AC3ECE4A - 95701AB7-EBB4-4546-88D7-6C79AC3ECE4A
+
+ 96F89E54-2569-4E61-8B1E-1ECE796D0C50
+
+ from
+ D53523DA-0107-41B1-AF26-994C959D0368 - D53523DA-0107-41B1-AF26-994C959D0368
+ to
+ 0BEC556E-EA09-484A-9F98-8FB2E335ABA3 - 0BEC556E-EA09-484A-9F98-8FB2E335ABA3
+
+ A1D784D6-A1C5-413E-9EDC-22C1E24DB933
+
+ from
+ 95701AB7-EBB4-4546-88D7-6C79AC3ECE4A - 95701AB7-EBB4-4546-88D7-6C79AC3ECE4A
+ to
+ 29DDFD30-12AE-460D-BDE1-C7F96075940B - 29DDFD30-12AE-460D-BDE1-C7F96075940B
+
+
+ workflowMetaData
+
+ workflowTypeIdentifier
+ com.apple.Automator.workflow
+
+
+
diff --git a/README.md b/README.md
index 5c823f37..82c3772a 100644
--- a/README.md
+++ b/README.md
@@ -40,3 +40,19 @@ Usage
- To delete all existing bounding boxes in the image, simply click `ClearAll`.
3. After finishing one image, click `Next` to advance. Likewise, click `Prev` to reverse. Or, input an image id and click `Go` to navigate to the speficied image.
- Be sure to click `Next` after finishing a image, or the result won't be saved.
+
+
+ProcessImages.workflow is an automator script to do the following in order:
+ - 1. Get the images to work on
+ - 2. Change the type of the images to JPEG format
+ - 3. Change extension of all files to .JPEG (some files will have .jpg and .JPG etc.) because the BBox tool will accept only *.JPEG extension files.
+ - 4. Scale all the images to 320 px in largest side so that Bbox tool will have a neat image to work on and it will be easy for ML training as well.
+
+
+process.py file is from https://timebutt.github.io/static/how-to-train-yolov2-to-detect-custom-objects/. This file randomly categorizes an image into training or test data based on the percentage configured in the script for testing. The output of this is fed into darknet for training purpose
+
+
+check.py - Jinesh authored this initially. check.py file is needed to see if every image file is properly associated with a text annotation file. The script finally copies only those image files for which it has a corresponding text annotation. Multiple annotation in a single image file and the corresponding image files are moved into a separate folder to keep it clean.
+
+
+Added convert.py from https://github.com/Guanghan/darknet/blob/master/scripts/convert.py with modifications within it. The basic purpose of this script is to convert the BBox label annotation into Yolo format
diff --git a/changeClass.py b/changeClass.py
new file mode 100644
index 00000000..2d61eef0
--- /dev/null
+++ b/changeClass.py
@@ -0,0 +1,25 @@
+#changeClass.py script changes the class index name in all the text files in a folder to the desired index from corresponding *.names file which will be consequently fed in for training
+
+import os
+from shutil import copyfile
+
+labelFolder = "/obj/"
+newLabelFolder = "/newObj/"
+arr = os.listdir('./obj/')
+for file in arr:
+ if file.endswith ('.txt'):
+ filePath = os.path.join(os.getcwd() +labelFolder, file)
+ newfilePath = os.path.join(os.getcwd() +newLabelFolder, file)
+ f = open(filePath, "r")
+ fout = open (newfilePath, "w")
+ lines = f.readlines()
+ for line in lines:
+ fout.write(line.replace ('0','21',1))
+ #f.write (line.replace ('0','21',1))
+ #with open(filePath) as fin, open(os.path.join(os.getcwd() +newLabelFolder, file), "w") as fout:
+ #for line in fin:
+ #fout.write(line.replace ('0','21',1))
+ #f.write (line.replace ('0','21',1))
+ else:
+ copyfile (os.path.join(os.getcwd() + labelFolder, file), os.path.join(os.getcwd() + newLabelFolder, file))
+
\ No newline at end of file
diff --git a/check.py b/check.py
new file mode 100644
index 00000000..59340634
--- /dev/null
+++ b/check.py
@@ -0,0 +1,55 @@
+#Jinesh authored this initially. check.py file is needed to see if every image file is properly associated with a text annotation file. The script finally copies only those image files for which it has a corresponding text annotation. Multiple annotation in a single image file and the corresponding image files are moved into a separate folder to keep it clean.
+
+import os
+from shutil import copyfile
+labelFolder = "/Labels/004/"
+imagesFolder = "/Images/004/"
+arr = os.listdir('./Images/004/')
+outputFolder = "/Result/"
+multipleResultsFolder = "/multiple-result/"
+print (arr)
+outputDirectory = os.path.join(os.getcwd(), outputFolder)
+multipleResultsDirectory = os.path.join(os.getcwd(), multipleResultsFolder)
+for file in arr:
+ # compose JPEG file name
+ textFile = file.replace(".JPEG",".txt")
+ jpegFile = os.path.join(os.getcwd() +imagesFolder, file)
+ filePath = os.path.join(os.getcwd() +labelFolder, textFile)
+ print ('Hello World!')
+ print ('JPEG file exists: ' + str(os.path.isfile(jpegFile)))
+ print ('Text file exists: ' + str(os.path.isfile(filePath)))
+ if (os.path.isfile(jpegFile) and os.path.isfile(filePath)):
+ print ('Both files exists')
+ try:
+ f = open(filePath, "r")
+ #num_lines = sum(1 for line in f)
+ print ("File contents: ")
+ print (f)
+ length = len(f.readlines())
+ f.close()
+ print(length)
+ if (length <= 1 ):
+ print("Less in length")
+ #delete image and text file
+ #os.remove(jpegFile)
+ #f.close()
+ #os.remove(filePath)
+ #continue
+ elif(length > 2):
+ print("Moving this File to multiple result directory")
+ #os.rename(jpegFile, os.path.join(os.getcwd(), imagesFolder) + "/" + "multiple/" + file)
+ #os.rename(filePath, os.path.join(os.getcwd(), labelFolder) + "/" + "multiple/" + textFile)
+ copyfile (jpegFile, os.path.join(os.getcwd() + multipleResultsFolder + "/images/", file))
+ copyfile (filePath, os.path.join(os.getcwd() + multipleResultsFolder + "/labels/", textFile))
+ else:
+ print("Moving this File to result directory")
+ copyfile (jpegFile, os.path.join(os.getcwd() + outputFolder + "/images/", file))
+ copyfile (filePath, os.path.join(os.getcwd() + outputFolder + "/labels/", textFile))
+ except Exception as e:
+ print(e)
+ #delete file
+ #os.remove(jpegFile)
+ else:
+ print ("Image and text counterpart not found!")
+ print ("JPEG File: " + jpegFile)
+ print ("Text File: " + filePath)
diff --git a/convert.py b/convert.py
new file mode 100644
index 00000000..c82ec83f
--- /dev/null
+++ b/convert.py
@@ -0,0 +1,112 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Wed Dec 9 14:55:43 2015
+
+This script is to convert the txt annotation files to appropriate format needed by YOLO
+
+@author: Guanghan Ning
+Email: gnxr9@mail.missouri.edu
+"""
+
+#Added convert.py from https://github.com/Guanghan/darknet/blob/master/scripts/convert.py with modifications within it. The basic purpose of this script is to convert the BBox label annotation into Yolo format
+
+import os
+from os import walk, getcwd
+from PIL import Image
+
+classes = ["helmet"]
+
+def convert(size, box):
+ dw = 1./size[0]
+ dh = 1./size[1]
+ x = (box[0] + box[1])/2.0
+ y = (box[2] + box[3])/2.0
+ w = box[1] - box[0]
+ h = box[3] - box[2]
+ x = x*dw
+ w = w*dw
+ y = y*dh
+ h = h*dh
+ return (x,y,w,h)
+
+
+"""-------------------------------------------------------------------"""
+
+""" Configure Paths"""
+cls = "helmet"
+
+#Raj: Changes in code to run it directory specific! working directory needs "images" folder where all images are there!
+workingDirectory = "multiple-result"
+mypath = "/Users/i305138/SAP/SKOM/BBox-Label-Tool/" + workingDirectory + "/labels/" + cls + "/"
+outpath = "/Users/i305138/SAP/SKOM/BBox-Label-Tool/" + workingDirectory + "/labels-yolo/" + cls + "/"
+
+if cls not in classes:
+ exit(0)
+cls_id = classes.index(cls)
+
+print ("Found class, class ID: " + str(cls_id))
+
+wd = getcwd()
+list_file = open('%s/%s/%s_list.txt'%(wd, workingDirectory, cls), 'w')
+
+""" Get input text file list """
+print ("My Path: " + mypath)
+txt_name_list = []
+for (dirpath, dirnames, filenames) in walk(mypath):
+ txt_name_list.extend(filenames)
+ break
+print(txt_name_list)
+if '.DS_Store' in txt_name_list: txt_name_list.remove('.DS_Store')
+print(txt_name_list)
+""" Process """
+for txt_name in txt_name_list:
+ # txt_file = open("Labels/stop_sign/001.txt", "r")
+
+ """ Open input text files """
+ txt_path = mypath + txt_name
+ print("Input:" + txt_path)
+ txt_file = open(txt_path, "r")
+ lines = txt_file.read().split('\n') #for ubuntu, use "\r\n" instead of "\n"
+ print ("Source Lines: "+ str (lines))
+ """ Open output text files """
+ txt_outpath = outpath + txt_name
+ print("Output:" + txt_outpath)
+ txt_outfile = open(txt_outpath, "w")
+
+
+ """ Convert the data to YOLO format """
+ ct = 0
+ for line in lines:
+ #print('lenth of line is: ')
+ #print(len(line))
+ #print('\n')
+ if(len(line) >= 2):
+ ct = ct + 1
+ print(line + "\n")
+ elems = line.split(' ')
+ print(elems)
+ xmin = elems[0]
+ xmax = elems[2]
+ ymin = elems[1]
+ ymax = elems[3]
+ #
+ img_path = str('%s/%s/images/%s/%s.JPEG'%(wd, workingDirectory, cls, os.path.splitext(txt_name)[0]))
+ #t = magic.from_file(img_path)
+ #wh= re.search('(\d+) x (\d+)', t).groups()
+ im=Image.open(img_path)
+ w= int(im.size[0])
+ h= int(im.size[1])
+ #w = int(xmax) - int(xmin)
+ #h = int(ymax) - int(ymin)
+ # print(xmin)
+ print(w, h)
+ b = (float(xmin), float(xmax), float(ymin), float(ymax))
+ bb = convert((w,h), b)
+ print(bb)
+ txt_outfile.write(str(cls_id) + " " + " ".join([str(a) for a in bb]) + '\n')
+
+ """ Save those images with bb into list"""
+ if(ct != 0):
+ list_file.write('%s/%s/images/%s/%s.JPEG\n'%(wd, workingDirectory, cls, os.path.splitext(txt_name)[0]))
+
+list_file.close()
diff --git a/process.py b/process.py
new file mode 100644
index 00000000..bfc22d25
--- /dev/null
+++ b/process.py
@@ -0,0 +1,31 @@
+#process.py file is from https://timebutt.github.io/static/how-to-train-yolov2-to-detect-custom-objects/. This file randomly categorizes an image into training or test data based on the percentage configured in the script for testing. The output of this is fed into darknet for training purpose
+
+import glob, os
+
+# Current directory
+current_dir = os.path.dirname(os.path.abspath(__file__))
+folderName = "TrainingImagesWithAnnotation"
+
+# Directory where the data will reside, relative to 'darknet.exe'
+path_data = 'data/obj/'
+
+# Percentage of images to be used for the test set
+percentage_test = 10;
+
+# Create and/or truncate train.txt and test.txt
+file_train = open('train.txt', 'w')
+file_test = open('test.txt', 'w')
+
+# Populate train.txt and test.txt
+counter = 1
+index_test = round(100 / percentage_test)
+print ("Current directory: " + current_dir)
+for pathAndFilename in glob.iglob(os.path.join(current_dir + "/" + folderName, "*.JPEG")):
+ title, ext = os.path.splitext(os.path.basename(pathAndFilename))
+
+ if counter == index_test:
+ counter = 1
+ file_test.write(path_data + title + '.JPEG' + "\n")
+ else:
+ file_train.write(path_data + title + '.JPEG' + "\n")
+ counter = counter + 1
\ No newline at end of file