├── COWC-M ├── CreateDetectionPatches.py ├── CreateDetectionScenes.py ├── CreatePatchLabels.py └── README.md ├── ECCV ├── CountSlidingWindowECCV.py └── SimpleSlidingWindowECCV.py ├── LICENSE └── README.md /COWC-M/CreateDetectionPatches.py: -------------------------------------------------------------------------------- 1 | # ================================================================================================ 2 | # 3 | # Cars Overhead With Context 4 | # 5 | # http://gdo-datasci.ucllnl.org/cowc/ 6 | # 7 | # T. Nathan Mundhenk, Goran Konjevod, Wesam A. Sakla, Kofi Boakye 8 | # 9 | # Lawrence Livermore National Laboratory 10 | # Global Security Directorate 11 | # 12 | # February 2018 13 | # 14 | # mundhenk1@llnl.gov 15 | # 16 | # ================================================================================================ 17 | # 18 | # Copyright (C) 2018 Lawrence Livermore National Security 19 | # 20 | # This program is free software: you can redistribute it and/or modify 21 | # it under the terms of the GNU Affero General Public License as 22 | # published by the Free Software Foundation, either version 3 of the 23 | # License, or (at your option) any later version. 24 | # 25 | # This program is distributed in the hope that it will be useful, 26 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | # GNU Affero General Public License for more details. 29 | # 30 | # You should have received a copy of the GNU Affero General Public License 31 | # along with this program. If not, see . 32 | # 33 | # ================================================================================================ 34 | # 35 | # This work performed under the auspices of the U.S. Department of Energy by Lawrence Livermore 36 | # National Laboratory under Contract DE-AC52-07NA27344. 37 | # 38 | # LLNL-MI-702797 39 | # 40 | # ================================================================================================ 41 | 42 | import pickle 43 | import math 44 | import cv2 45 | import numpy as np 46 | import string 47 | import os 48 | import shutil 49 | import sys 50 | 51 | # The pickle file with the list of cars 52 | # ftp://gdo152.ucllnl.org/cowc-m/datasets/Objects_15cm_24px-exc_v5-marg-32.pickle 53 | unique_list = '/Users/mundhenk1/Downloads/temp/Objects_15cm_24px-exc_v5-marg-32.pickle' 54 | # The location of the raw scenes 55 | # ftp://gdo152.ucllnl.org/cowc-m/datasets/Organized_Raw_Files.tgz 56 | raw_image_root = '/Users/mundhenk1/Downloads/temp/Organized_Raw_Files' 57 | # Where to save the new patches we create on our local drive 58 | output_image_root = '/Users/mundhenk1/Downloads/temp/64x64_15cm_24px-exc_v5-marg-32_expanded' 59 | 60 | 61 | # Here we specify the size of each patch along with a margin of mean gray to wrap the image in 62 | # We give four suggestions for sizes 63 | 64 | # Suggestion 1 65 | #patch_size = 256 66 | #marg_size = 32 67 | 68 | # Suggestion 2 69 | #patch_size = 232 70 | #marg_size = 20 71 | 72 | # Suggestion 3 73 | #patch_size = 120 74 | #marg_size = 4 75 | 76 | # Suggestion 4 77 | patch_size = 64 78 | marg_size = 4 79 | 80 | # If we set this to more than zero, we will create that many extra patches with color permutations 81 | color_permutes = 0 82 | 83 | # For each patch, we will also create its rotation. Here we list all the rotations we would like to create 84 | rotation_set = [0,15,30,45,60,75,90,105,120,135,150,165,180] 85 | # For testing we do the same, but use fewer rotations to keep the testing set more compact 86 | test_rotations = [0,15,30,45] 87 | # We can create multiple scales in addition the just the standard one 88 | # Scales must be >= 1.0 89 | scale_set = [1.0] 90 | # This is the mean color used in the margin. 91 | mean_color = [104, 117, 123] 92 | 93 | # ******************************************************************************************************************* 94 | # ******************************************************************************************************************* 95 | # Dont edit after here 96 | # ******************************************************************************************************************* 97 | # ******************************************************************************************************************* 98 | 99 | 100 | #======================================================================================================================== 101 | 102 | class CarProp: 103 | def __init__(self,phase,type,loc_1,loc_2): 104 | self.phase = phase 105 | self.type = type 106 | self.loc_1 = loc_1 107 | self.loc_2 = loc_2 108 | 109 | #======================================================================================================================== 110 | 111 | def create_zoom_crop_image(in_image, patch_size, marg_size, visible_size, mean_color, zoom): 112 | 113 | out_image = np.empty((patch_size,patch_size,3),dtype=np.uint8) 114 | out_image[:,:,0] = mean_color[0] 115 | out_image[:,:,1] = mean_color[1] 116 | out_image[:,:,2] = mean_color[2] 117 | 118 | if zoom != 1.0: 119 | in_image_scaled = cv2.resize(in_image,(0,0),fx=float(zoom),fy=float(zoom)) 120 | else: 121 | in_image_scaled = in_image 122 | 123 | out_center = int(patch_size//2) 124 | in_center = int(in_image_scaled.shape[0]//2) 125 | 126 | x1_out = int(out_center-visible_size//2) 127 | x2_out = int(out_center+visible_size//2+1) 128 | y1_out = int(out_center-visible_size//2) 129 | y2_out = int(out_center+visible_size//2+1) 130 | 131 | x1_in = int(in_center-visible_size//2) 132 | x2_in = int(in_center+visible_size//2+1) 133 | y1_in = int(in_center-visible_size//2) 134 | y2_in = int(in_center+visible_size//2+1) 135 | 136 | out_image[y1_out:y2_out,x1_out:x2_out,:] = in_image[y1_in:y2_in,x1_in:x2_in,:] 137 | 138 | return out_image.astype(np.uint8) 139 | 140 | #======================================================================================================================== 141 | 142 | def permute_affine(in_img, r_rotate): 143 | rot = cv2.getRotationMatrix2D((in_img.shape[1]//2, in_img.shape[0]//2), r_rotate, 1.0) 144 | out_img = cv2.warpAffine(in_img, rot, (in_img.shape[1], in_img.shape[0])) 145 | return out_img.astype(np.uint8) 146 | 147 | #======================================================================================================================== 148 | 149 | def rotate_hue(img): 150 | 151 | npermute = np.random.randint(0,5) 152 | 153 | if npermute == 0: 154 | nimg = img[:,:,[1,0,2]] 155 | elif npermute == 1: 156 | nimg = img[:,:,[2,1,0]] 157 | elif npermute == 2: 158 | nimg = img[:,:,[0,2,1]] 159 | elif npermute == 3: 160 | nimg = img[:,:,[1,2,0]] 161 | elif npermute == 4: 162 | nimg = img[:,:,[2,0,1]] 163 | 164 | return nimg 165 | 166 | #======================================================================================================================== 167 | #======================================================================================================================== 168 | 169 | # patch required is the required image for rotation. We force it to be even. 170 | # We use this to get our initial crop from the large raw scene. It's over sized so we can 171 | # then crop out the rotated patch without running out of bounds. 172 | patch_required = int( round( math.sqrt(patch_size*patch_size + patch_size*patch_size)/2.0 ) )*2 173 | if patch_required%2 != 0: 174 | patch_required = patch_required + 1 175 | 176 | visible_size = patch_size - 2*marg_size 177 | 178 | # load in the list of car locations and negatives for creating patches 179 | print("Loading: " + unique_list) 180 | 181 | in_file = open(unique_list, 'rb') 182 | 183 | item_list = pickle.load(in_file) 184 | 185 | # Create the output directory if we don't have one yet 186 | if not os.path.isdir(output_image_root): 187 | os.mkdir(output_image_root) 188 | 189 | # we will run through all sample locations which are sorted by the original dataset (e.g. CSUAV or Utah) 190 | for file_dir in sorted(item_list): 191 | 192 | print("Processing Dir:\t" + file_dir) 193 | 194 | set_raw_root = os.path.join(raw_image_root, file_dir) 195 | set_output_root = os.path.join(output_image_root, file_dir) 196 | 197 | if not os.path.isdir(set_output_root): 198 | os.mkdir(set_output_root) 199 | 200 | set_output_root_test = os.path.join(set_output_root, 'test') 201 | set_output_root_train = os.path.join(set_output_root, 'train') 202 | 203 | if not os.path.isdir(set_output_root_test): 204 | os.mkdir(set_output_root_test) 205 | 206 | if not os.path.isdir(set_output_root_train): 207 | os.mkdir(set_output_root_train) 208 | 209 | # For each of the large raw scene images 210 | for file_root in sorted(item_list[file_dir]): 211 | 212 | raw_file = os.path.join(set_raw_root, "{}.png".format(file_root)) 213 | 214 | pstring = "\tReading Raw File:\t" + raw_file + " ... " 215 | 216 | sys.stdout.write(pstring) 217 | sys.stdout.flush() 218 | 219 | # load the large raw scene image 220 | raw_image = cv2.imread(raw_file) 221 | 222 | print("Image Size: ") 223 | print(raw_image.shape) 224 | 225 | print("Done") 226 | 227 | print("Processing:") 228 | 229 | counter = 0 230 | 231 | # for each sample in this scene image 232 | for locs in item_list[file_dir][file_root]: 233 | 234 | # Get the location of this sample 235 | loc_1 = int(locs.loc_1) 236 | loc_2 = int(locs.loc_2) 237 | 238 | temp_name = "{}.{}.{:05d}.{:05d}".format(locs.type, file_root, loc_1, loc_2) 239 | full_temp_name = os.path.join(set_output_root, locs.phase, temp_name) 240 | 241 | # detemine the window location of this patch within the large raw scene 242 | x1 = int(loc_1-patch_required//2) 243 | x2 = int(loc_1+patch_required//2) 244 | y1 = int(loc_2-patch_required//2) 245 | y2 = int(loc_2+patch_required//2) 246 | 247 | # make sure we're in bounds, if not we can just add more gray area 248 | if x1 < 0 or y1 < 0 or x2 >= raw_image.shape[1] or y2 >= raw_image.shape[0]: 249 | 250 | # We are running outside the large raw scene image, so we need to get the visible 251 | # area and then make the part of the patch that lies outside the image gray 252 | temp_image = np.empty((patch_required,patch_required,3),dtype=np.uint8) 253 | temp_image[:,:,0] = mean_color[0] 254 | temp_image[:,:,1] = mean_color[1] 255 | temp_image[:,:,2] = mean_color[2] 256 | ty1 = 0 257 | tx1 = 0 258 | ty2 = patch_required 259 | tx2 = patch_required 260 | ny1 = y1 261 | nx1 = x1 262 | ny2 = y2 263 | nx2 = x2 264 | 265 | if y1 < 0: 266 | ty1 = -y1 267 | ny1 = 0 268 | 269 | if x1 < 0: 270 | tx1 = -x1 271 | nx1 = 0 272 | 273 | if x2 >= raw_image.shape[1]: 274 | tx2 = patch_required + (raw_image.shape[1] - x2) - 1 275 | nx2 = raw_image.shape[1] - 1 276 | 277 | if y2 >= raw_image.shape[0]: 278 | ty2 = patch_required + (raw_image.shape[0] - y2) - 1 279 | ny2 = raw_image.shape[0] - 1 280 | 281 | # Get the part of the image that is inside the scene 282 | temp_image[ty1:ty2,tx1:tx2,:] = raw_image[ny1:ny2,nx1:nx2,:] 283 | cropped_raw_image = temp_image 284 | else: 285 | # Patch is totally inside the image, we just crop out it. We leave some slack so we can 286 | # crop out a final rotated image later 287 | cropped_raw_image = np.empty((patch_required,patch_required,3),dtype=np.uint8) 288 | cropped_raw_image[:,:,:] = raw_image[y1:y2,x1:x2,:] 289 | 290 | r_set = [] 291 | 292 | # if we are using a training image, we load a different set of rotation permutions than 293 | # if we are using testing images 294 | if locs.phase == "test": 295 | r_set = test_rotations 296 | else: 297 | r_set = rotation_set 298 | 299 | # for each rotation permutation 300 | for rot in r_set: 301 | 302 | # create the rotated patch image 303 | rot_img = permute_affine(cropped_raw_image, rot) 304 | 305 | for scale in scale_set: 306 | 307 | file_name = "{}.{}.{:05d}.{:05d}.{:04.2f}-{:03d}.jpg".format(locs.type, file_root, loc_1, loc_2, scale, rot) 308 | 309 | full_file_name = os.path.join(set_output_root, locs.phase, file_name) 310 | 311 | # Zoom in if requested and do a final crop. 312 | out_image = create_zoom_crop_image(rot_img, patch_size, marg_size, visible_size, mean_color, scale) 313 | 314 | # Write the image patch out 315 | cv2.imwrite(full_file_name, out_image, [int(cv2.IMWRITE_JPEG_QUALITY), 95]) 316 | 317 | # only do color permutions on the training data 318 | if locs.phase == "train": 319 | 320 | # if we want to create color permutations, do it here. 321 | for p in range(color_permutes): 322 | 323 | # We apply augmentation to the already cropped patch 324 | nout = rotate_hue(out_image) 325 | 326 | file_name = "{}.{}.{:05d}.{:05d}.{:04.2f}-{:03d}-HueRot-{}.jpg".format(locs.type, file_root, loc_1, loc_2, scale, rot, p) 327 | 328 | full_file_name = os.path.join(set_output_root, locs.phase, file_name) 329 | 330 | # Write the image patch out 331 | cv2.imwrite(full_file_name, nout, [int(cv2.IMWRITE_JPEG_QUALITY), 95]) 332 | 333 | if counter > 0: 334 | if counter%100 == 0: 335 | sys.stdout.write('.') 336 | sys.stdout.flush() 337 | if counter%5000 == 0: 338 | sys.stdout.write('\n') 339 | sys.stdout.flush() 340 | counter += 1 341 | 342 | print('x') 343 | 344 | 345 | 346 | 347 | -------------------------------------------------------------------------------- /COWC-M/CreateDetectionScenes.py: -------------------------------------------------------------------------------- 1 | # ================================================================================================ 2 | # 3 | # Cars Overhead With Context 4 | # 5 | # http://gdo-datasci.ucllnl.org/cowc/ 6 | # 7 | # T. Nathan Mundhenk, Goran Konjevod, Wesam A. Sakla, Kofi Boakye 8 | # 9 | # Lawrence Livermore National Laboratory 10 | # Global Security Directorate 11 | # 12 | # February 2018 13 | # 14 | # mundhenk1@llnl.gov 15 | # 16 | # ================================================================================================ 17 | # 18 | # Copyright (C) 2018 Lawrence Livermore National Security 19 | # 20 | # This program is free software: you can redistribute it and/or modify 21 | # it under the terms of the GNU Affero General Public License as 22 | # published by the Free Software Foundation, either version 3 of the 23 | # License, or (at your option) any later version. 24 | # 25 | # This program is distributed in the hope that it will be useful, 26 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | # GNU Affero General Public License for more details. 29 | # 30 | # You should have received a copy of the GNU Affero General Public License 31 | # along with this program. If not, see . 32 | # 33 | # ================================================================================================ 34 | # 35 | # This work performed under the auspices of the U.S. Department of Energy by Lawrence Livermore 36 | # National Laboratory under Contract DE-AC52-07NA27344. 37 | # 38 | # LLNL-MI-702797 39 | # 40 | # ================================================================================================ 41 | 42 | import pickle 43 | import math 44 | import cv2 45 | import numpy as np 46 | import string 47 | import os 48 | import shutil 49 | import sys 50 | import copy 51 | 52 | # ftp://gdo152.ucllnl.org/cowc-m/datasets/Objects_All.pickle 53 | #unique_list = '/Users/mundhenk1/Downloads/temp/Objects_All.pickle' 54 | unique_list = r"C:\Users\mundhenk1\Downloads\COWC\cowc-m\datasets\Objects_All.pickle" # Windows Example 55 | # ftp://gdo152.ucllnl.org/cowc-m/datasets/Organized_Raw_Files.tgz 56 | #raw_image_root = '/Users/mundhenk1/Downloads/temp/Organized_Raw_Files' 57 | raw_image_root = r"C:\Users\mundhenk1\Downloads\COWC\cowc-m\datasets\Organized_Raw_Files" # Windows Example 58 | # Somewhere on your local drive 59 | #output_image_root = '/Users/mundhenk1/Downloads/temp/DetectionPatches_256x256' 60 | output_image_root = r"C:\Users\mundhenk1\Downloads\COWC\cowc-m\outputs\DetectionPatches_256x256" # Windows Example 61 | 62 | # How large should each example patch be 63 | patch_size = 256 64 | # striding step for extract patches from the large orignal image 65 | step_size = 128 66 | # Should we also extract negative examples (no you shouldn't) 67 | cars_only = True 68 | # How many pixels in size is the typical car? 69 | car_size = 32 70 | 71 | # ******************************************************************************************************************* 72 | # ******************************************************************************************************************* 73 | # Dont edit after here 74 | # ******************************************************************************************************************* 75 | # ******************************************************************************************************************* 76 | 77 | #======================================================================================================================== 78 | 79 | class CarProp: 80 | def __init__(self,phase,type,loc_1,loc_2,obj_class): 81 | r""" 82 | This stores attributes for each car in the dataset. 83 | """ 84 | self.phase = phase 85 | self.type = type 86 | self.loc_1 = loc_1 87 | self.loc_2 = loc_2 88 | self.obj_class = obj_class 89 | 90 | #======================================================================================================================== 91 | 92 | def create_zoom_crop_image(in_image, patch_size, marg_size, visible_size, mean_color, zoom): 93 | r""" 94 | This will crop out an image and optionally add a margin or zoom in on it. 95 | """ 96 | out_image = np.empty((patch_size,patch_size,3),dtype=np.uint8) 97 | out_image[:,:,0] = mean_color[0] 98 | out_image[:,:,1] = mean_color[1] 99 | out_image[:,:,2] = mean_color[2] 100 | 101 | 102 | if zoom != 1.0: 103 | in_image_scaled = cv2.resize(in_image,(0,0),fx=float(zoom),fy=float(zoom)) 104 | else: 105 | in_image_scaled = in_image 106 | 107 | out_center = int(patch_size//2) 108 | in_center = int(in_image_scaled.shape[0]//2) 109 | 110 | x1_out = int(out_center-visible_size//2) 111 | x2_out = int(out_center+visible_size//2+1) 112 | y1_out = int(out_center-visible_size//2) 113 | y2_out = int(out_center+visible_size//2+1) 114 | 115 | x1_in = int(in_center-visible_size//2) 116 | x2_in = int(in_center+visible_size//2+1) 117 | y1_in = int(in_center-visible_size//2) 118 | y2_in = int(in_center+visible_size//2+1) 119 | 120 | out_image[y1_out:y2_out,x1_out:x2_out,:] = in_image[y1_in:y2_in,x1_in:x2_in,:] 121 | 122 | return out_image.astype(np.uint8) 123 | 124 | #======================================================================================================================== 125 | 126 | def permute_affine(in_img, r_rotate): 127 | r""" 128 | This will properly rotate an image patch. 129 | """ 130 | rot = cv2.getRotationMatrix2D((in_img.shape[1]//2, in_img.shape[0]//2), r_rotate, 1.0) 131 | out_img = cv2.warpAffine(in_img, rot, (in_img.shape[1], in_img.shape[0])) 132 | 133 | return out_img.astype(np.uint8) 134 | 135 | #======================================================================================================================== 136 | #======================================================================================================================== 137 | 138 | assert(patch_size%step_size==0) 139 | part_steps = int(patch_size / step_size) 140 | 141 | # patch required is the required image for rotation. We force it to be even 142 | patch_required = int( round( math.sqrt(patch_size*patch_size + patch_size*patch_size)/2.0 ) )*2 143 | if patch_required%2 != 0: 144 | patch_required = patch_required + 1 145 | 146 | # Get the list of all pre-annotated objects. 147 | print("Loading: " + unique_list) 148 | 149 | in_file = open(unique_list, 'rb') 150 | 151 | item_list = pickle.load(in_file) 152 | 153 | if not os.path.isdir(output_image_root): 154 | os.mkdir(output_image_root) 155 | 156 | # We will store a single CSV file with the counts of cars from all patches we generate. 157 | count_file = os.path.join(output_image_root,"object_count.csv") 158 | count_file_handle = open(count_file,'w') 159 | count_file_handle.write("Folder_Name,File_Name,Neg_Count,Other_Count,Pickup_Count,Sedan_Count,Unknown_Count\n") 160 | 161 | # For each large sub directory set we have (e.g. Utah, Selwyn) 162 | for file_dir in sorted(item_list): 163 | 164 | print("Processing Dir:\t" + file_dir) 165 | 166 | set_raw_root = os.path.join(raw_image_root , file_dir) 167 | set_output_root = os.path.join(output_image_root , file_dir) 168 | 169 | if not os.path.isdir(set_raw_root): 170 | print(">>> WARNING \"{}\" NOT FOUND, Skipping since it may be \"held-out\". You probably don\'t want this.".format(set_raw_root)) 171 | continue 172 | 173 | if not os.path.isdir(set_output_root): 174 | os.mkdir(set_output_root) 175 | 176 | # For each large raw file in this sub directory set... 177 | for file_root in sorted(item_list[file_dir]): 178 | 179 | raw_file = os.path.join(set_raw_root, "{}.png".format(file_root)) 180 | 181 | pstring = "\tReading Raw File:\t" + raw_file + " ... " 182 | 183 | sys.stdout.write(pstring) 184 | sys.stdout.flush() 185 | 186 | # Read the large raw overhead file 187 | raw_image = cv2.imread(raw_file) 188 | 189 | print("Image Size: ") 190 | print(raw_image.shape) 191 | 192 | print("Done") 193 | 194 | print("Processing:") 195 | 196 | counter = 0 197 | 198 | # Get how many patches/steps we will have using patch size and stride 199 | steps_x = int(int(raw_image.shape[1])//int(step_size)) 200 | steps_y = int(int(raw_image.shape[0])//int(step_size)) 201 | 202 | step_locs = [] 203 | 204 | for y in range(steps_y + 1): 205 | ts = [] 206 | for x in range(steps_x + 1): 207 | ts.append([]) 208 | 209 | step_locs.append(ts) 210 | 211 | # stuff objects into location bins 212 | for locs in item_list[file_dir][file_root]: 213 | 214 | loc_1 = int(locs.loc_1) 215 | loc_2 = int(locs.loc_2) 216 | 217 | step_loc_1 = int(loc_1)//int(step_size) 218 | step_loc_2 = int(loc_2)//int(step_size) 219 | 220 | step_locs[step_loc_2][step_loc_1].append(locs) 221 | 222 | for y in range(steps_y): 223 | # Patch bounds along Y 224 | y1 = y * step_size 225 | y2 = y1 + patch_size 226 | 227 | if y2 > raw_image.shape[0]: 228 | break 229 | 230 | for x in range(steps_x): 231 | # Patch bounds along X 232 | x1 = x * step_size 233 | x2 = x1 + patch_size 234 | 235 | if x2 > raw_image.shape[1]: 236 | break 237 | 238 | # File names for things we will save 239 | im_name_base = "{}.{}.{}.jpg".format(file_root,x,y) 240 | bb_name = os.path.join(set_output_root,"{}.{}.{}.txt".format(file_root,x,y)) 241 | im_name = os.path.join(set_output_root,im_name_base) 242 | ck_name = os.path.join(set_output_root,"{}.{}.{}.check.jpg".format(file_root,x,y)) 243 | 244 | img_patch = raw_image[y1:y2,x1:x2,:] 245 | 246 | # Get a list of all objects within this image patch 247 | obj_list = [] 248 | 249 | for sy in range(part_steps): 250 | for sx in range(part_steps): 251 | for locs in step_locs[y + sy][x + sx]: 252 | if locs.obj_class != 0: 253 | obj_list.append(locs) 254 | 255 | count = [0,0,0,0,0] 256 | 257 | # Write out the raw unlabeled image patch 258 | cv2.imwrite(im_name, img_patch, [int(cv2.IMWRITE_JPEG_QUALITY), 95]) 259 | img_patch_cp = copy.deepcopy(img_patch) 260 | 261 | r""" 262 | Is there at least on object in the patch? Otherwise don't bother trying 263 | to draw the bounding box images with boxes. We also skip creating the 264 | bounding box list file. 265 | """ 266 | if len(obj_list) > 0: 267 | 268 | bb_file = open(bb_name,'w') 269 | 270 | # in case we want to do something else, we keep the obj_list list 271 | for l in obj_list: 272 | x_loc = float(int(l.loc_1) - x1)/float(patch_size) 273 | y_loc = float(int(l.loc_2) - y1)/float(patch_size) 274 | h = float(car_size)/float(patch_size) 275 | w = float(car_size)/float(patch_size) 276 | 277 | # Write out the bounding boxes 278 | if cars_only: 279 | if l.obj_class != 0: 280 | bb_file.write("{} {} {} {} {}\n".format(l.obj_class,x_loc,y_loc,h,w)) 281 | else: 282 | bb_file.write("{} {} {} {} {}\n".format(l.obj_class,x_loc,y_loc,h,w)) 283 | 284 | # Count this object 285 | count[l.obj_class] += 1 286 | 287 | # Get the color which goes with this class 288 | if l.obj_class == 0: 289 | # white 290 | col = (255, 255, 255) 291 | elif l.obj_class == 1: 292 | # red 293 | col = (0, 0, 255) 294 | elif l.obj_class == 2: 295 | # green 296 | col = (0, 255, 0) 297 | elif l.obj_class == 3: 298 | # blue 299 | col = (255, 0, 0) 300 | elif l.obj_class == 4: 301 | # purple 302 | col = (150, 0, 200) 303 | 304 | # Get the bounding box for drawing in OpenCV 305 | x_1 = int(int(l.loc_1) - x1 + (car_size // 2)) 306 | y_1 = int(int(l.loc_2) - y1 + (car_size // 2)) 307 | x_2 = int(int(l.loc_1) - x1 - (car_size // 2)) 308 | y_2 = int(int(l.loc_2) - y1 - (car_size // 2)) 309 | 310 | coords = [x_1, y_1, x_2, y_2] 311 | # Check bounds 312 | for i in range(len(coords)): 313 | coord = coords[i] 314 | if coord < 0: 315 | coords[i] = 0 316 | if coord > patch_size: 317 | coords[i] = patch_size 318 | 319 | # Draw the box 320 | img_patch_cp = cv2.rectangle(img_patch_cp, (coords[0], coords[1]), (coords[2], coords[3]), col, 1) 321 | 322 | # Write the image with the bounding boxes in it. 323 | cv2.imwrite(ck_name, img_patch_cp) 324 | 325 | r""" 326 | Write out a central file with the count of each vehicle type for each patch. 327 | 328 | Count File Format: Folder_Name,File_Name,Neg_Count,Other_Count,Pickup_Count,Sedan_Count,Unknown_Count 329 | """ 330 | count_file_handle.write("{},{}".format(file_dir,im_name_base)) 331 | for i in count: 332 | count_file_handle.write(",{}".format(i)) 333 | count_file_handle.write("\n") 334 | 335 | # Show a very simple progress counter 336 | if counter > 0: 337 | if counter%100 == 0: 338 | sys.stdout.write('.') 339 | sys.stdout.flush() 340 | if counter%5000 == 0: 341 | sys.stdout.write('\n') 342 | sys.stdout.flush() 343 | counter += 1 344 | 345 | print('x') 346 | 347 | 348 | 349 | 350 | 351 | -------------------------------------------------------------------------------- /COWC-M/CreatePatchLabels.py: -------------------------------------------------------------------------------- 1 | # ================================================================================================ 2 | # 3 | # Cars Overhead With Context 4 | # 5 | # http://gdo-datasci.ucllnl.org/cowc/ 6 | # 7 | # T. Nathan Mundhenk, Goran Konjevod, Wesam A. Sakla, Kofi Boakye 8 | # 9 | # Lawrence Livermore National Laboratory 10 | # Global Security Directorate 11 | # 12 | # February 2018 13 | # 14 | # mundhenk1@llnl.gov 15 | # 16 | # ================================================================================================ 17 | # 18 | # Copyright (C) 2018 Lawrence Livermore National Security 19 | # 20 | # This program is free software: you can redistribute it and/or modify 21 | # it under the terms of the GNU Affero General Public License as 22 | # published by the Free Software Foundation, either version 3 of the 23 | # License, or (at your option) any later version. 24 | # 25 | # This program is distributed in the hope that it will be useful, 26 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | # GNU Affero General Public License for more details. 29 | # 30 | # You should have received a copy of the GNU Affero General Public License 31 | # along with this program. If not, see . 32 | # 33 | # ================================================================================================ 34 | # 35 | # This work performed under the auspices of the U.S. Department of Energy by Lawrence Livermore 36 | # National Laboratory under Contract DE-AC52-07NA27344. 37 | # 38 | # LLNL-MI-702797 39 | # 40 | # ================================================================================================ 41 | 42 | import os 43 | import shutil 44 | 45 | # ================================================================================================ 46 | 47 | # This is a directory where we have a set of uniquely labeled car images 48 | # ftp://gdo152.ucllnl.org/cowc-m/datasets/Sorted_Cars_By_Type_15cm_24px-exc_v5-marg-32_expanded.tgz 49 | type_dir = '/Users/mundhenk1/Downloads/temp/Sorted_Cars_By_Type_15cm_24px-exc_v5-marg-32_expanded' 50 | 51 | # These are raw images we will match to the labeled car images 52 | # ftp://gdo152.ucllnl.org/cowc-m/datasets/64x64_15cm_24px-exc_v5-marg-32_expanded.tgz 53 | # OR 54 | # You can create your own with CreateDetectionPatches.py 55 | data_dir = '/Users/mundhenk1/Downloads/temp/64x64_15cm_24px-exc_v5-marg-32_expanded' 56 | 57 | # Where should we 58 | train_list_file = os.path.join(data_dir, 'train_list_TARANTO.txt') 59 | test_list_file = os.path.join(data_dir, 'test_list_TARANTO.txt') 60 | 61 | # Ignore the unknown labeled cars? Set this to {4} 62 | ignore_list = {4} 63 | # Otherwise, leave blank to use the unknown 64 | #ignore_list = {} 65 | 66 | # For old style 2, for expanded 3 67 | endlen = 3 68 | 69 | # What label should we give each item? 70 | # The order here is {Not Car, Other, Pickup, Sedan, Unknown 71 | label_str_list = ["0","1","2","3","4"] 72 | 73 | # If zero, we give no extra samples, otherwise we do that many extra (times) for each sample 74 | # The order here is {Not Car, Other, Pickup, Sedan, Unknown 75 | extra_samples = [0,0,0,0,0] 76 | 77 | # ================================================================================================ 78 | # ================================================================================================ 79 | # DONT'T EDIT BELOW HERE 80 | # ================================================================================================ 81 | # ================================================================================================ 82 | 83 | def getClass(file_name, label_set, car_prefix, endlen): 84 | 85 | file_part = file_name.split('.') 86 | 87 | if file_part[0] == car_prefix: 88 | 89 | unique_name = '' 90 | 91 | for n in range(len(file_part)-endlen): 92 | unique_name = unique_name + file_part[n] + '_' 93 | 94 | return label_set[unique_name] 95 | 96 | else: 97 | return 0 98 | 99 | # ================================================================================================ 100 | def getLabels(file_root, label_set, label_num): 101 | 102 | # file_root: 103 | # e.g. /g/g17/mundhetn/data/CarsOverheadWithContext/Sorted_Cars_By_Type/CSUAV/Pickup 104 | 105 | file_list = os.listdir(file_root) 106 | 107 | for file in sorted(file_list): 108 | 109 | # file: 110 | # e.g. car.Columbus_EO_Run01_s2_301_15_00_42.40561128-Oct-2007_11-00-47.194_Frame_74.02085.01928.000.png 111 | 112 | file_part = file.split('.') 113 | 114 | unique_name = '' 115 | 116 | for n in range(len(file_part)-2): 117 | 118 | # e.g. car.Columbus_EO_Run01_s2_301_15_00_42.40561128-Oct-2007_11-00-47.194_Frame_74.02085.01928 119 | unique_name = unique_name + file_part[n] + '_' 120 | 121 | label_set[unique_name] = label_num 122 | 123 | return label_set 124 | 125 | # ================================================================================================ 126 | # Get the lable of each car by directory 127 | # ================================================================================================ 128 | 129 | files_root = os.listdir(type_dir) 130 | 131 | print('Do Lists') 132 | 133 | label_set = {} 134 | 135 | for file_dir in sorted(files_root): 136 | 137 | if os.path.isdir(type_dir + '/' + file_dir): 138 | 139 | # e.g. /g/g17/mundhetn/data/CarsOverheadWithContext/Sorted_Cars_By_Type/CSUAV 140 | 141 | print("Doing Type Directory: {}".format(os.path.join(type_dir, file_dir))) 142 | 143 | other_loc = os.path.join(type_dir, file_dir, 'Other') 144 | pickup_loc = os.path.join(type_dir, file_dir, 'Pickup') 145 | sedan_loc = os.path.join(type_dir, file_dir, 'Sedan') 146 | unknown_loc = os.path.join(type_dir, file_dir, 'Unknown') 147 | 148 | label_set = getLabels(other_loc, label_set, 1) 149 | label_set = getLabels(pickup_loc, label_set, 2) 150 | label_set = getLabels(sedan_loc, label_set, 3) 151 | label_set = getLabels(unknown_loc, label_set, 4) 152 | 153 | # ================================================================================================ 154 | # Get each sample and match to label 155 | # ================================================================================================ 156 | 157 | test_count = [0,0,0,0,0] 158 | train_count = [0,0,0,0,0] 159 | test_samples = 0 160 | train_samples = 0 161 | car_prefix = 'car' 162 | 163 | files_root = os.listdir(data_dir) 164 | 165 | print('Do Lists') 166 | 167 | test_out_list = open(test_list_file, 'w') 168 | train_out_list = open(train_list_file, 'w') 169 | 170 | for file_dir in sorted(files_root): 171 | 172 | if os.path.isdir(os.path.join(data_dir, file_dir)): 173 | 174 | print("Doing Data Directory: {}".format(os.path.join(data_dir,file_dir))) 175 | 176 | test_loc = os.path.join(data_dir, file_dir, 'test') 177 | test_files = os.listdir(test_loc) 178 | 179 | for test_file in sorted(test_files): 180 | car_class = getClass(test_file, label_set, car_prefix, endlen) 181 | test_count[car_class] += 1 182 | if car_class in ignore_list: 183 | continue 184 | line = os.path.join(test_loc, test_file) + '\t' + "{}".format(label_str_list[car_class]) + "\n" 185 | test_out_list.write(line) 186 | test_samples += 1 187 | 188 | train_loc = os.path.join(data_dir, file_dir, 'train') 189 | train_files = os.listdir(train_loc) 190 | 191 | for train_file in sorted(train_files): 192 | car_class = getClass(train_file, label_set, car_prefix, endlen) 193 | train_count[car_class] += 1 194 | if car_class in ignore_list: 195 | continue 196 | line = os.path.join(train_loc, train_file) + '\t' + "{}".format(label_str_list[car_class]) + "\n" 197 | 198 | train_out_list.write(line) 199 | train_samples += 1 200 | 201 | for e in range(extra_samples[car_class]): 202 | train_out_list.write(line) 203 | train_samples += 1 204 | train_count[car_class] += 1 205 | 206 | 207 | print("Writing: {}".format(test_list_file)) 208 | test_out_list.close() 209 | print("Writing: {}".format(train_list_file)) 210 | train_out_list.close() 211 | 212 | print("Train Neg: " + "{}".format(train_count[0])) 213 | print("Train Other: " + "{}".format(train_count[1])) 214 | print("Train Pickup: " + "{}".format(train_count[2])) 215 | print("Train Sedan: " + "{}".format(train_count[3])) 216 | print("Train Unknown: " + "{}".format(train_count[4])) 217 | print("Train SAMPLES: " + "{}".format(train_samples)) 218 | 219 | print("Test Neg: " + "{}".format(test_count[0])) 220 | print("Test Other: " + "{}".format(test_count[1])) 221 | print("Test Pickup: " + "{}".format(test_count[2])) 222 | print("Test Sedan: " + "{}".format(test_count[3])) 223 | print("Test Unknown: " + "{}".format(test_count[4])) 224 | print("Test SAMPLES: " + "{}".format(test_samples)) 225 | 226 | 227 | -------------------------------------------------------------------------------- /COWC-M/README.md: -------------------------------------------------------------------------------- 1 | (1) Introduction 2 | 3 | The COWC-M dataset extends our original COWC dataset described in ECCV ’16 by labeling 4 | the cars with types. Each car is now labeled as either Sedan, Pickup, Other or Unknown. 5 | We have also created tools to help one create new patches or extract labeled sets 6 | compatible with standard detection methods such as Faster-RCNN. 7 | 8 | You can either use the scripts provided to extract new data or you can download pre-made 9 | datasets from: 10 | 11 | ftp://gdo152.ucllnl.org/cowc-m/datasets/ 12 | 13 | (2) COWC-M data extraction scripts 14 | 15 | These are scripts for extracting training patches of different types from the COWC-M dataset. 16 | Two of them will extract patches and label them for use with Caffe in a way that is similar 17 | to our original patches from ECCV ’16. The main differences is that now the type of car is 18 | labeled as Sedan, Pickup, Other and Unknown rather than as just ‘car’. We describe them more 19 | later, but the scripts are: 20 | 21 | CreateDetectionPatches.py 22 | CreatePatchLabels.py 23 | 24 | Note that you can just download pre-extracted patches from our ftp at: 25 | 26 | ftp://gdo152.ucllnl.org/cowc-m/datasets/64x64_15cm_24px-exc_v5-marg-32_expanded.tgz 27 | 28 | The other script will extract cars with detection locations in a manner more compatible with 29 | detection methods such as Faster-RCNN. This creates multiple patch scenes and a location label 30 | for each scene. This is called: 31 | 32 | CreateDetectionScenes.py 33 | 34 | It will also count the number of each car type in each image for use with the counting task. 35 | 36 | (3) Creating new patches 37 | 38 | There are only three steps to creating your own training patches: 39 | 40 | 1) Open up the python scripts and edit the path locations at the top 41 | 2) Download the data files shown at the top of the script 42 | 3) Run the script. 43 | 44 | I have left the paths as I would use them so you can see an example of usage, but you need 45 | to change these. For example: 46 | 47 | unique_list = '/Users/mundhenk1/Downloads/temp/Objects_15cm_24px-exc_v5-marg-32.pickle' 48 | 49 | You might change to: 50 | 51 | unique_list = '/my/directory/on/my/machine/Objects_15cm_24px-exc_v5-marg-32.pickle' 52 | 53 | Don’t literally do this, just point it towards your local copy. 54 | 55 | You then create new patches by first calling CreateDetectionPatches.py. This will create a set of 56 | training images. Next you will need to run CreatePatchLabels.py to create a set of patch labels. 57 | Once you have called both, you should have all you need to train a Caffe network on your data. 58 | 59 | (4) Creating new scenes and counting 60 | 61 | You run this in the same way as for creating training patches, but you don’t need to run a script 62 | to extract labels. This is in part because different detection engines use different labeling 63 | schemes. You should use the script CreatePatchScenes.py more as an example for how to do this 64 | and make changes as needed. 65 | 66 | This method will also count the number of each type of car and put it in a single file. So, this 67 | can be used to create counts of cars by type for each scene. 68 | 69 | (5) Please feel free to email me with questions and comments. 70 | 71 | This source was updated January 2021 to support Python 3 and Windows OS. 72 | 73 | ---- 74 | 75 | T. Nathan Mundhenk 76 | mundhenk1@llnl.gov 77 | 78 | 79 | -------------------------------------------------------------------------------- /ECCV/CountSlidingWindowECCV.py: -------------------------------------------------------------------------------- 1 | # ================================================================================================ 2 | # 3 | # Cars Overhead With Context 4 | # 5 | # http://gdo-datasci.ucllnl.org/cowc/ 6 | # 7 | # T. Nathan Mundhenk, Goran Konjevod, Wesam A. Sakla, Kofi Boakye 8 | # 9 | # Lawrence Livermore National Laboratory 10 | # Global Security Directorate 11 | # 12 | # February 2016 13 | # 14 | # ================================================================================================ 15 | # 16 | # Copyright (C) 2016 Lawrence Livermore National Security 17 | # 18 | # This program is free software: you can redistribute it and/or modify 19 | # it under the terms of the GNU Affero General Public License as 20 | # published by the Free Software Foundation, either version 3 of the 21 | # License, or (at your option) any later version. 22 | # 23 | # This program is distributed in the hope that it will be useful, 24 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | # GNU Affero General Public License for more details. 27 | # 28 | # You should have received a copy of the GNU Affero General Public License 29 | # along with this program. If not, see . 30 | # 31 | # ================================================================================================ 32 | # 33 | # This work performed under the auspices of the U.S. Department of Energy by Lawrence Livermore 34 | # National Laboratory under Contract DE-AC52-07NA27344. 35 | # 36 | # LLNL-MI-702797 37 | # 38 | # ================================================================================================ 39 | # 40 | # Sorry about the ugly python. I just joined the pyrty recently. Enjoy. 41 | # 42 | # 43 | # ================================================================================================ 44 | 45 | import caffe 46 | import numpy as np 47 | import string 48 | import cv2 49 | import os 50 | import math 51 | import time 52 | 53 | # ================================================================================================ 54 | class WinProp: 55 | def __init__(self): 56 | self.x1 = 0 57 | self.x2 = 0 58 | self.y1 = 0 59 | self.y2 = 0 60 | 61 | # ================================================================================================ 62 | 63 | # The directory of your images 64 | input_root_dir = "LOCATION OF MY IMAGES" 65 | 66 | # The list of your input images 67 | input_image_file_list = [] 68 | 69 | input_image_file_list.append(input_root_dir + '12TVK440540_CROP_01.png') # 628 70 | 71 | input_image_file_list.append(input_root_dir + '12TVK440540_CROP_02.png') # 285 72 | input_image_file_list.append(input_root_dir + '12TVK440540_CROP_03.png') # 140 73 | input_image_file_list.append(input_root_dir + '12TVK440540_CROP_04.png') # 596 74 | input_image_file_list.append(input_root_dir + '12TVK440540_CROP_05.png') # 881 75 | input_image_file_list.append(input_root_dir + '12TVK440540_CROP_06.png') # 94 76 | input_image_file_list.append(input_root_dir + '12TVK440540_CROP_07.png') # 28 77 | input_image_file_list.append(input_root_dir + '12TVK440540_CROP_08.png') # 208 78 | input_image_file_list.append(input_root_dir + '12TVL180480_CROP_09.png') # 249 79 | input_image_file_list.append(input_root_dir + '12TVL180480_CROP_10.png') # 215 80 | input_image_file_list.append(input_root_dir + '12TVK460400_CROP_11.png') # 498 81 | 82 | input_image_file_list.append(input_root_dir + '12TVL220060_CROP_1.png') # 51 83 | input_image_file_list.append(input_root_dir + '12TVL220060_CROP_2.png') # 42 84 | input_image_file_list.append(input_root_dir + '12TVL460100_CROP_1.png') # 22 85 | input_image_file_list.append(input_root_dir + '12TVL460100_CROP_2.png') # 23 86 | input_image_file_list.append(input_root_dir + '12TVK220780_CROP_1.png') # 20 87 | input_image_file_list.append(input_root_dir + '12TVK220780_CROP_2.png') # 20 88 | input_image_file_list.append(input_root_dir + '12TVL240360_CROP_1.png') # 28 89 | input_image_file_list.append(input_root_dir + '12TVL240360_CROP_2.png') # 36 90 | input_image_file_list.append(input_root_dir + '12TVL160120_CROP_1.png') # 10 91 | input_image_file_list.append(input_root_dir + '12TVL160120_CROP_2.png') # 10 92 | 93 | # The ground truth count for each image 94 | ground_truth_list = [628,285,140,596,881,94,28,208,249,215,498,51,42,22,23,20,20,28,36,10,10] 95 | # Which images should be included in the final statistics 96 | use_image_list = [0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] 97 | 98 | # ================================================================================================ 99 | 100 | # Give a list of strides to use at different offsets. 101 | stride_list = [] 102 | stride_list.append([0,0]) 103 | #stride_list.append([0,4]) 104 | #stride_list.append([4,0]) 105 | #stride_list.append([4,4]) 106 | 107 | # render/save some nifty output images showing how things are going? 108 | render_images = True 109 | # How large (in pixels) should each stride be for a sliding window 110 | window_stride = 167 111 | # Padding to add at the border of the image in pixels 112 | window_pad = 128 #104 or 128 113 | # The batch size to use in Caffe 114 | batch_size = 50 # between 16 and 64 115 | # The GPU device to use in Caffe 116 | gpu_device = 3 117 | # What is the first layer in the network the images will be sent to? 118 | start_layer = 'Layer1_7x7/Convolution_Stride_2' 119 | # What is the softmax output layer? 120 | softmax_layer = 'loss3/Softmax_plain' 121 | # The location of your prototxt network training file. 122 | prototxt_net_file = 'LOCATION OF MY TRAINING FILE' 123 | # The location of your trained caffe model 124 | caffemodel_file = 'LOCATION OF MY MODEL FILE' 125 | 126 | window_scale = 1.0 / float(len(stride_list)) 127 | 128 | # ================================================================================================ 129 | 130 | # Initialize your caffe network 131 | 132 | caffe.set_device(gpu_device) 133 | caffe.set_mode_gpu() 134 | 135 | print 'Load network' 136 | 137 | net = caffe.Net(prototxt_net_file, caffemodel_file, caffe.TEST) 138 | 139 | print 'Create Transformer' 140 | 141 | net.blobs['data'].reshape(batch_size,3,224,224) 142 | 143 | # Set up the image transformer 144 | 145 | transformer = caffe.io.Transformer({'data': net.blobs['data'].data.shape}) 146 | transformer.set_transpose('data', (2,0,1)) 147 | transformer.set_mean('data', np.float32([104.0, 117.0, 123.0])) # mean pixel 148 | 149 | # Init a bunch of counters and things 150 | 151 | mean_caffe_time = 0.0 152 | image_count = 0 153 | MAE = 0.0 154 | RMSE = 0.0 155 | sum_gt = 0.0 156 | sum_count = 0.0 157 | N = 0.0 158 | max_error = 0.0 159 | 160 | print "START COUNTING ...." 161 | 162 | # For each image stride over and count 163 | for input_image_file in input_image_file_list: 164 | 165 | total_counter = 0.0 166 | caffe_runs = 0 167 | final_bins = 0 168 | caffe_time = 0.0 169 | 170 | # Open up our image. This is lazy and does not check the image to see if it's valid. 171 | input_image = cv2.imread(input_image_file) 172 | 173 | # This is the list of different stride offsets. 174 | for s in stride_list: 175 | 176 | # Set the current from the list offset 177 | xs = s[0] 178 | ys = s[1] 179 | 180 | # create a padded blank image 181 | input_image_pad = np.zeros((input_image.shape[0]+window_pad*2, input_image.shape[1]+window_pad*2, 3), dtype=np.uint8) 182 | 183 | # copy the original image into the center but offset it by xs,ys 184 | input_image_pad[ys+window_pad:ys+window_pad+input_image.shape[0],\ 185 | xs+window_pad:xs+window_pad+input_image.shape[1],:] = input_image 186 | 187 | # set up images to keep track of statistics for output after we are done. 188 | count_image = np.zeros((input_image.shape[0]+window_pad*2, input_image.shape[1]+window_pad*2, 3), dtype=np.uint8) 189 | box_image = np.zeros((input_image.shape[0]+window_pad*2, input_image.shape[1]+window_pad*2, 3), dtype=np.uint8) 190 | prop_image = np.zeros((input_image.shape[0]+window_pad*2, input_image.shape[1]+window_pad*2, 3), dtype=np.uint8) 191 | 192 | im_cols = input_image_pad.shape[1]/window_stride 193 | im_rows = input_image_pad.shape[0]/window_stride 194 | 195 | py = input_image.shape[0]/window_stride 196 | px = input_image.shape[1]/window_stride 197 | 198 | crop_img = np.zeros((224,224,3),dtype=np.uint8) 199 | crop_img[:,:,0] = 104 200 | crop_img[:,:,1] = 117 201 | crop_img[:,:,2] = 123 202 | 203 | start = time.time() 204 | 205 | frame_count = 0 206 | 207 | y = 0 208 | x = 0 209 | do_batch = True 210 | 211 | # While we still have window patches to feed into caffe 212 | while do_batch == True: 213 | 214 | x_counter = 0; 215 | win_props = [] 216 | 217 | # Get batch_size number of windows into Caffe blobs 218 | for bx in range(batch_size): 219 | 220 | # Stop when we run out of image 221 | if x > px: 222 | x = 0 223 | y += 1 224 | if y > py: 225 | do_batch = False 226 | break 227 | 228 | # Define the window 229 | w = WinProp(); 230 | w.y1 = y*window_stride 231 | w.y2 = 255 + y*window_stride 232 | w.x1 = x*window_stride 233 | w.x2 = 255 + x*window_stride 234 | 235 | x_counter += 1 236 | frame_count += 1 237 | 238 | # Process window and plut into Caffe 239 | cv_img = input_image_pad[w.y1:w.y2, w.x1:w.x2, :] 240 | crop_img[16:208,16:208,:] = cv_img[32:224,32:224,:] 241 | net.blobs['data'].data[bx,:,:,:] = transformer.preprocess('data', crop_img) 242 | 243 | win_props.append(w) 244 | 245 | x += 1 246 | 247 | # Process this batch of window patches 248 | cstart = time.time() 249 | if start_layer != 'data': 250 | net.forward(start=start_layer) # Provide our own data 251 | else: 252 | net.forward() 253 | 254 | smax4 = net.blobs[softmax_layer].data 255 | cend = time.time() 256 | 257 | caffe_time += cend - cstart 258 | caffe_runs += 1 259 | 260 | # For each patch in our batch, get the results. 261 | for bx in range(x_counter): 262 | 263 | # get the max ... the lazy way 264 | max_bin = -1 265 | max_val = -1 266 | bin_count = 0 267 | for sbin in smax4[bx]: 268 | if sbin > max_val: 269 | max_val = sbin 270 | max_bin = bin_count # my class as a bin construct, not same as bin_size 271 | bin_count += 1 272 | 273 | if render_images: 274 | w = win_props[bx] 275 | w.x1 = w.x1 + 32 276 | w.y1 = w.y1 + 32 277 | w.x2 = w.x2 - 32 278 | w.y2 = w.y2 - 32 279 | 280 | #draw some images that shows the count 281 | if bx%2 == 0: 282 | cv2.rectangle(box_image, (w.x1,w.y1), (w.x2,w.y2), (0,255,0), 3) 283 | else: 284 | cv2.rectangle(box_image, (w.x1,w.y1), (w.x2,w.y2), (255,0,0), 3) 285 | 286 | cv2.putText(box_image, "{}".format(max_bin), (w.x1+32,w.y2-32), cv2.FONT_HERSHEY_COMPLEX, 1.0, (0,0,255)) 287 | 288 | if max_bin > 0: 289 | cv2.rectangle(prop_image, (w.x1,w.y1), (w.x2,w.y2), (255,255,255), -1) 290 | 291 | total_counter += float(max_bin) * window_scale 292 | 293 | final_bins += 1 294 | 295 | if render_images: 296 | # blend the box image and the input padded image 297 | input_image_pad[:,:, 2] = box_image[:,:, 2]/2 + input_image_pad[:,:, 2]/2 298 | input_image_pad[:,:, 1] = box_image[:,:, 1]/2 + input_image_pad[:,:, 1]/2 299 | input_image_pad[:,:, 0] = box_image[:,:, 0]/2 + input_image_pad[:,:, 0]/2 300 | 301 | # write the images 302 | file_name = input_image_file + ".{}.{}.count.jpg".format(xs,ys) 303 | print "Saving Image: " + file_name 304 | cv2.imwrite(file_name,input_image_pad) 305 | 306 | file_name = input_image_file + ".{}.{}.prop.png".format(xs,ys) 307 | print "Saving Image: " + file_name 308 | cv2.imwrite(file_name,prop_image) 309 | 310 | end = time.time() 311 | 312 | mean_caffe_time += caffe_time 313 | 314 | print "**************************" 315 | print "IMAGE: " + input_image_file 316 | print "Time caffe: {}".format(caffe_time) 317 | print "Total windows processed: {}".format(frame_count) 318 | print "Caffe batches: {}".format(caffe_runs) 319 | print ">>> CAR COUNT: {}".format(total_counter) 320 | print ">>> GROUND TRUTH: {}".format(ground_truth_list[image_count]) 321 | 322 | if use_image_list[image_count]: 323 | error = total_counter - ground_truth_list[image_count] 324 | perror = abs(error)/ground_truth_list[image_count] 325 | MAE += perror 326 | RMSE += perror*perror 327 | sum_gt += ground_truth_list[image_count] 328 | sum_count += total_counter 329 | N += 1.0 330 | max_error = max(max_error,perror) 331 | 332 | print ">>> ERROR: {}".format(error) 333 | print ">>> PERCENT ERROR: {}".format(perror) 334 | else: 335 | print ">>> VALIDATION IMAGE" 336 | 337 | image_count += 1 338 | 339 | mean_caffe_time /= len(input_image_file_list) 340 | MAE /= N 341 | RMSE = math.sqrt(RMSE/N) 342 | total_error = abs(sum_gt - sum_count) / sum_gt 343 | 344 | print "**************************" 345 | print "RESULTS" 346 | print "**************************" 347 | print "Mean time caffe: {}".format(mean_caffe_time) 348 | print "MAE: {}".format(MAE) 349 | print "RMSE: {}".format(RMSE) 350 | print "Max Error: {}".format(max_error) 351 | print "Total Error: {}".format(total_error) 352 | 353 | 354 | 355 | -------------------------------------------------------------------------------- /ECCV/SimpleSlidingWindowECCV.py: -------------------------------------------------------------------------------- 1 | # ================================================================================================ 2 | # 3 | # Cars Overhead With Context 4 | # 5 | # http://gdo-datasci.ucllnl.org/cowc/ 6 | # 7 | # T. Nathan Mundhenk, Goran Konjevod, Wesam A. Sakla, Kofi Boakye 8 | # 9 | # Lawrence Livermore National Laboratory 10 | # Global Security Directorate 11 | # 12 | # February 2016 13 | # 14 | # ================================================================================================ 15 | # 16 | # Copyright (C) 2016 Lawrence Livermore National Security 17 | # 18 | # This program is free software: you can redistribute it and/or modify 19 | # it under the terms of the GNU Affero General Public License as 20 | # published by the Free Software Foundation, either version 3 of the 21 | # License, or (at your option) any later version. 22 | # 23 | # This program is distributed in the hope that it will be useful, 24 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | # GNU Affero General Public License for more details. 27 | # 28 | # You should have received a copy of the GNU Affero General Public License 29 | # along with this program. If not, see . 30 | # 31 | # ================================================================================================ 32 | # 33 | # This work performed under the auspices of the U.S. Department of Energy by Lawrence Livermore 34 | # National Laboratory under Contract DE-AC52-07NA27344. 35 | # 36 | # LLNL-MI-702797 37 | # 38 | # ================================================================================================ 39 | # 40 | # Sorry about the ugly python. I just joined the pyrty recently. Enjoy. 41 | # 42 | # 43 | # ================================================================================================ 44 | 45 | import caffe 46 | import numpy as np 47 | import cv2 48 | import math 49 | from copy import deepcopy 50 | 51 | # ================================================================================================ 52 | 53 | class WinProp: 54 | def __init__(self): 55 | self.x = -1 56 | self.y = -1 57 | self.val = 0 58 | self.have_max = False 59 | 60 | # ================================================================================================ 61 | 62 | def getNextWindow(temp_p_map, threshold): 63 | 64 | p = WinProp() 65 | 66 | loc = np.argmax(temp_p_map) 67 | p.y = loc / temp_p_map.shape[1] 68 | p.x = loc % temp_p_map.shape[1] 69 | p.val = temp_p_map[p.y,p.x] 70 | 71 | if p.val > threshold: 72 | p.have_max = True 73 | else: 74 | p.have_max = False 75 | 76 | return p 77 | 78 | # ================================================================================================ 79 | 80 | def getWindows(win_excl_size, temp_p_map, threshold): 81 | 82 | winPropSet = [] 83 | 84 | have_more = True 85 | 86 | while have_more: 87 | p = getNextWindow(temp_p_map, threshold) 88 | 89 | if p.have_max == False: 90 | have_more = False 91 | break 92 | 93 | winPropSet.append(p) 94 | 95 | minx = max(p.x-win_excl_size/2, 0) 96 | miny = max(p.y-win_excl_size/2, 0) 97 | 98 | maxx = min(p.x+win_excl_size/2,temp_p_map.shape[1]) 99 | maxy = min(p.y+win_excl_size/2,temp_p_map.shape[0]) 100 | 101 | temp_p_map[miny:maxy,minx:maxx] = 0 102 | 103 | return winPropSet 104 | 105 | # ================================================================================================ 106 | 107 | def drawWindows(img, winPropSet, win_size, rescale=1): 108 | 109 | for p in winPropSet: 110 | if (rescale*p.x)-win_size/2 >= 0 and (rescale*p.y)-win_size/2 >= 0 and \ 111 | (rescale*p.y)+win_size/2 < img.shape[0] and (rescale*p.x)+win_size/2 < img.shape[1]: 112 | cv2.rectangle(img,\ 113 | ((rescale*p.x)-win_size/2,(rescale*p.y)-win_size/2),\ 114 | ((rescale*p.x)+win_size/2,(rescale*p.y)+win_size/2),\ 115 | (255,255,0)) 116 | cv2.rectangle(img,\ 117 | ((rescale*p.x)-win_size/2-2,(rescale*p.y)-win_size/2-2),\ 118 | ((rescale*p.x)+win_size/2+2,(rescale*p.y)+win_size/2+2),\ 119 | (0,255,255)) 120 | else: 121 | cv2.rectangle(img,\ 122 | ((rescale*p.x)-win_size/2,(rescale*p.y)-win_size/2),\ 123 | ((rescale*p.x)+win_size/2,(rescale*p.y)+win_size/2),\ 124 | (0,0,255)) 125 | 126 | return img 127 | 128 | 129 | # ================================================================================================ 130 | 131 | # The Sampling stride over the image 132 | window_stride = 8 133 | # how many patches can we fit in one batch 134 | batch_size = 64 135 | # which GPU device to use 136 | gpu_device = 0 137 | # skew placed on probability 138 | log_power = 16 139 | # numeric threshold for a detection (0 to 255) 140 | threshold = 196 141 | # The starting layer in your network 142 | start_layer = 'Layer1_7x7/Convolution_Stride_2' 143 | # The final softmax output layer 144 | softmax_layer = 'loss3/Softmax_plain' 145 | # The network prototxt file for Caffe 146 | prototxt_net_file = 'LOCATION OF MY TRAINING PROTOTXT' 147 | # The trained caffe model 148 | caffemodel_file = 'LOCATION OF MY CAFFE MODEL' 149 | # name to append to result files 150 | method_label = 'train_val_COWC_v3' 151 | 152 | 153 | # Mean image values 154 | mean_image_vals = [104.0, 117.0, 123.0] 155 | # detection window size 156 | detect_win_size = 48 157 | # window exclusion size 158 | win_excl_size = 64/window_stride 159 | 160 | # don't mess with these 161 | window_size = 255 162 | window_pad = window_size/2 163 | patch_size = 224 164 | 165 | # ================================================================================================ 166 | 167 | # The directory of your images 168 | input_root_dir = "LOCATION OF MY IMAGES" 169 | 170 | # The list of your input images 171 | input_image_file_list = [] 172 | 173 | input_image_file_list.append(input_root_dir + '12TVK440540_CROP_01.png') 174 | 175 | input_image_file_list.append(input_root_dir + '12TVK440540_CROP_02.png') 176 | input_image_file_list.append(input_root_dir + '12TVK440540_CROP_03.png') 177 | input_image_file_list.append(input_root_dir + '12TVK440540_CROP_04.png') 178 | input_image_file_list.append(input_root_dir + '12TVK440540_CROP_05.png') 179 | input_image_file_list.append(input_root_dir + '12TVK440540_CROP_06.png') 180 | input_image_file_list.append(input_root_dir + '12TVK440540_CROP_07.png') 181 | input_image_file_list.append(input_root_dir + '12TVK440540_CROP_08.png') 182 | input_image_file_list.append(input_root_dir + '12TVL180480_CROP_09.png') 183 | input_image_file_list.append(input_root_dir + '12TVL180480_CROP_10.png') 184 | input_image_file_list.append(input_root_dir + '12TVK460400_CROP_11.png') 185 | 186 | input_image_file_list.append(input_root_dir + '12TVL220060_CROP_1.png') 187 | input_image_file_list.append(input_root_dir + '12TVL220060_CROP_2.png') 188 | input_image_file_list.append(input_root_dir + '12TVL460100_CROP_1.png') 189 | input_image_file_list.append(input_root_dir + '12TVL460100_CROP_2.png') 190 | input_image_file_list.append(input_root_dir + '12TVK220780_CROP_1.png') 191 | input_image_file_list.append(input_root_dir + '12TVK220780_CROP_2.png') 192 | input_image_file_list.append(input_root_dir + '12TVL240360_CROP_1.png') 193 | input_image_file_list.append(input_root_dir + '12TVL240360_CROP_2.png') 194 | input_image_file_list.append(input_root_dir + '12TVL160120_CROP_1.png') 195 | input_image_file_list.append(input_root_dir + '12TVL160120_CROP_2.png') 196 | 197 | # ================================================================================================ 198 | 199 | caffe.set_device(gpu_device) 200 | caffe.set_mode_gpu() 201 | 202 | print 'Load network' 203 | 204 | net = caffe.Net(prototxt_net_file, caffemodel_file, caffe.TEST) 205 | 206 | print 'Create Transformer' 207 | 208 | net.blobs['data'].reshape(batch_size,3,patch_size,patch_size) 209 | 210 | transformer = caffe.io.Transformer({'data': net.blobs['data'].data.shape}) 211 | transformer.set_transpose('data', (2,0,1)) 212 | transformer.set_mean('data', np.float32(mean_image_vals)) # mean pixel 213 | 214 | batch_loc_x = [] 215 | batch_loc_y = [] 216 | 217 | for x in range(batch_size): 218 | batch_loc_x.append(0) 219 | batch_loc_y.append(0) 220 | 221 | for input_image_file in input_image_file_list: 222 | 223 | print "Running: " + input_image_file 224 | 225 | results_prefix = input_image_file + '.' + method_label + ".Stride-{}.".format(window_stride) 226 | input_image = cv2.imread(input_image_file) 227 | input_image_pad = np.zeros((input_image.shape[0]+window_pad*2, input_image.shape[1]+window_pad*2, 3), dtype=np.uint8) 228 | 229 | input_image_pad[window_pad:window_pad+input_image.shape[0],window_pad:window_pad+input_image.shape[1],:] = input_image 230 | 231 | im_cols = input_image_pad.shape[1]/window_stride 232 | im_rows = input_image_pad.shape[0]/window_stride 233 | 234 | p_img = np.zeros((input_image.shape[0]/window_stride,input_image.shape[1]/window_stride,1),dtype=float) 235 | lp_img = np.zeros((input_image.shape[0]/window_stride,input_image.shape[1]/window_stride,1),dtype=float) 236 | r_img = np.zeros((input_image.shape[0]/window_stride,input_image.shape[1]/window_stride,3),dtype=np.uint8) 237 | pr_img = np.zeros((input_image.shape[0]/window_stride,input_image.shape[1]/window_stride,3),dtype=np.uint8) 238 | thresh_img = np.zeros((input_image.shape[0]/window_stride,input_image.shape[1]/window_stride,3),dtype=np.uint8) 239 | pdisp_img = np.zeros((input_image.shape[0]/window_stride,input_image.shape[1]/window_stride,3),dtype=np.uint8) 240 | 241 | crop_img = np.zeros((patch_size ,patch_size ,3),dtype=np.uint8) 242 | crop_img[:,:,0] = mean_image_vals[0] 243 | crop_img[:,:,1] = mean_image_vals[1] 244 | crop_img[:,:,2] = mean_image_vals[2] 245 | 246 | x_range_size = int(math.ceil(float(p_img.shape[1])/float(batch_size))) 247 | 248 | pix = np.zeros((batch_size,3,1),dtype=np.uint8) 249 | 250 | image_counter = 0 251 | 252 | for y in range(p_img.shape[0]): 253 | 254 | print 'Row ' + "{}".format(y*window_stride) 255 | 256 | y1 = y*window_stride 257 | y2 = window_size + y*window_stride 258 | 259 | for sx in range(x_range_size): 260 | 261 | bx = 0 262 | 263 | while True: 264 | x = (bx + batch_size*sx) 265 | if x > p_img.shape[1]: 266 | break 267 | if bx == batch_size: 268 | break 269 | 270 | use_location = False 271 | 272 | x1 = x*window_stride 273 | x2 = window_size + x*window_stride 274 | 275 | cv_img = input_image_pad[y1:y2, x1:x2, :] 276 | crop_img[16:208,16:208,:] = cv_img[32:224,32:224,:] 277 | net.blobs['data'].data[bx,:,:,:] = transformer.preprocess('data', crop_img) 278 | batch_loc_x[bx] = x 279 | batch_loc_y[bx] = y 280 | pix[bx,:,0] = cv_img[window_size/2,window_size/2,:] 281 | 282 | bx += 1 283 | 284 | if start_layer != 'data': 285 | net.forward(start=start_layer) # Provide our own data 286 | else: 287 | net.forward() 288 | 289 | smax4 = net.blobs[softmax_layer].data 290 | 291 | for rx in range(bx): 292 | yy = batch_loc_y[rx] 293 | x = batch_loc_x[rx] 294 | 295 | p1 = np.math.pow(smax4[rx][0],10.0) 296 | p2 = np.math.pow(smax4[rx][1],10.0) 297 | p = (p2 - p1 + 1.0) / 2.0 298 | lp = pow(p2 - p1 + 1.0,log_power)/pow(2,log_power) 299 | 300 | p_img[yy,x,0] = p*255.0 301 | lp_img[yy,x,0] = lp*255.0 302 | r_img[yy,x,:] = pix[rx,:,0] 303 | pdisp_img[yy,x,1] = int(p*255.0) 304 | 305 | if p > 0.5: 306 | pr_img[yy,x,2] = np.round(p*255.0) 307 | pr_img[yy,x,0] = 0 308 | thresh_img[yy,x,2] = 255 309 | if p < 0.75: 310 | thresh_img[yy,x,2] = 255 311 | thresh_img[yy,x,1] = 255 312 | else: 313 | thresh_img[yy,x,2] = 255 314 | elif p < 0.5: 315 | if p > 0.25: 316 | thresh_img[yy,x,1] = 255 317 | pr_img[yy,x,0] = np.round(p*255.0) 318 | pr_img[yy,x,2] = 0 319 | 320 | 321 | pr_img[yy,x,1] = pix[rx,1,0] 322 | 323 | cv2.imshow("pr img",pr_img) 324 | cv2.imshow("Raw Prob",pdisp_img) 325 | cv2.imshow("P > 0.75;0.5;0.25",thresh_img) 326 | cv2.waitKey(1) 327 | 328 | # ================================================================================================ 329 | 330 | results_prefix = input_image_file + '.' + method_label + ".Stride-{}.".format(window_stride) 331 | out_root = results_prefix + "detect." 332 | pbyte_img = p_img.astype(np.uint8) 333 | 334 | print "Getting Windows" 335 | 336 | retval,pthresh_img = cv2.threshold(pbyte_img,threshold,255,cv2.THRESH_TOZERO) 337 | winPropSet = getWindows(win_excl_size, pthresh_img, 1) 338 | 339 | print "Drawing Windows" 340 | 341 | iiw_img = deepcopy(input_image) 342 | iiw_img = drawWindows(iiw_img, winPropSet, detect_win_size, iiw_img.shape[0]/r_img.shape[0]) 343 | iiw_img_sm = cv2.resize(iiw_img,(0,0),fx=0.25,fy=0.25) 344 | 345 | cv2.imshow("detections",iiw_img_sm) 346 | cv2.waitKey(1) 347 | 348 | p_name = results_prefix + 'p_img.jpg' 349 | lp_name = results_prefix + 'lp_img.jpg' 350 | r_name = results_prefix + 'r_img.jpg' 351 | pr_name = results_prefix + 'pr_img.jpg' 352 | iiw_name = out_root + 'iiw_img.jpg' 353 | 354 | print 'Saving ' + iiw_name 355 | 356 | cv2.imwrite(iiw_name,iiw_img) 357 | 358 | print 'Saving ' + p_name 359 | 360 | cv2.imwrite(p_name,p_img) 361 | 362 | print 'Saving ' + lp_name 363 | 364 | cv2.imwrite(lp_name,lp_img) 365 | 366 | print 'Saving ' + r_name 367 | 368 | cv2.imwrite(r_name,r_img) 369 | 370 | print 'Saving ' + pr_name 371 | 372 | cv2.imwrite(pr_name,pr_img) 373 | 374 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | (1) You can either use scripts related to our paper in ECCV ’16 2 | 3 | These are in the folder ECCV. 4 | 5 | See also our paper: 6 | 7 | Cars Overhead With Context related scripts described in Mundhenk et al. 2016 ECCV. 8 | 9 | For more information see: 10 | 11 | http://gdo152.ucllnl.org/cowc/ 12 | 13 | (2) OR ... Download new scripts for our COWC-M dataset. 14 | 15 | This set extends our original COWC dataset by adding labels for the types of cars. 16 | These are: 17 | 18 | a) Sedan 19 | b) Pickup 20 | c) Other 21 | d) Unknown 22 | 23 | We have also included tools to make it easier to process our labeled data than was 24 | the case previously. These scripts are in the folder COWC-M. 25 | 26 | The README.md file in COWC-M describes this further as well as usage. On github, you 27 | can just click on COWC-M and it will pop up. 28 | 29 | ---- 30 | 31 | T. Nathan Mundhenk 32 | mundhenk1@llnl.gov --------------------------------------------------------------------------------