diff --git a/results/misc/webapp_shot.png b/results/misc/webapp_shot.png new file mode 100644 index 0000000..91f5cd1 Binary files /dev/null and b/results/misc/webapp_shot.png differ diff --git a/src/webapp/TrainImage_Annotate/Annotate/static/js/script.js b/src/webapp/TrainImage_Annotate/Annotate/static/js/script.js index a935129..e3f4915 100644 --- a/src/webapp/TrainImage_Annotate/Annotate/static/js/script.js +++ b/src/webapp/TrainImage_Annotate/Annotate/static/js/script.js @@ -36,7 +36,7 @@ function nextBtnInit() $("#next").click(function() { currentImageIndex = parseInt($('#image_index').val()) - + clearCanvas() nextImage = (currentImageIndex + 1) % images.length; currentImageIndex = nextImage; @@ -66,8 +66,6 @@ function nextBtnInit() { window.location.href = "/draw/download"; }); - - } @@ -197,14 +195,6 @@ function mouseUp(e) rect.endingX = e.pageX - (this.offsetLeft+offsetLeftAdd); rect.endingY = e.pageY - (this.offsetTop+offsetTopAdd); - - console.log("Being"); - console.log("Starting X:", rect.startX); - console.log("Starting Y:", rect.startY); - console.log("Ending X:", rect.endingX); - console.log("Ending X:", rect.endingY); - console.log("Height:", rect.h); - if((rect.startX > rect.endingX) && (rect.startY > rect.endingY)) { rect.startX = rect.endingX; @@ -223,12 +213,7 @@ function mouseUp(e) { rect.startX = rect.startX + rect.w; } - // console.log("After everything"); - // console.log("Starting X:", rect.startX); - // console.log("Starting Y:", rect.startY); - // console.log("Ending X:", rect.endingX); - // console.log("Ending X:", rect.endingY); - // console.log("Height:", rect.h); + var tempRectTuple = [] // top-left tempRectTuple.push(rect.startX); @@ -240,8 +225,8 @@ function mouseUp(e) tempRectTuple.push(Math.abs(rect.w)); //height tempRectTuple.push(Math.abs(rect.h)); - console.log("temprect:", tempRectTuple); - //console.log(sdfs) + + var tempStr = "["+tempRectTuple+"]"; rect_tuple.push(tempRectTuple) diff --git a/src/webapp/TrainImage_Annotate/Annotate/views.py b/src/webapp/TrainImage_Annotate/Annotate/views.py index 5a0faf4..1eec7b1 100644 --- a/src/webapp/TrainImage_Annotate/Annotate/views.py +++ b/src/webapp/TrainImage_Annotate/Annotate/views.py @@ -87,17 +87,27 @@ def prepareArrayNMS(filename): # preparing tuples for i in range(0,num_rects): - x0 = math.isnan(float(data['bounding_box'][(6*i)+0])) - y0 = math.isnan(float(data['bounding_box'][(6*i)+1])) - x1 = math.isnan(float(data['bounding_box'][(6*i)+2])) - y1 = math.isnan(float(data['bounding_box'][(6*i)+3])) - - if not x0 and not x1 and not y0 and not y1: - temp_tuple = (float(data['bounding_box'][(6*i)+0]), float(data['bounding_box'][(6*i)+1]), float(data['bounding_box'][(6*i)+2]), float(data['bounding_box'][(6*i)+3])) - box_coords.append(temp_tuple) + x0_str = len(data['bounding_box'][(6*i)+0]) + y0_str = len(data['bounding_box'][(6*i)+1]) + x1_str = len(data['bounding_box'][(6*i)+2]) + y1_str = len(data['bounding_box'][(6*i)+0]) - area = (float(data['bounding_box'][(6*i)+2]) - float(data['bounding_box'][(6*i)+0])) * (float(data['bounding_box'][(6*i)+3]) - float(data['bounding_box'][(6*i)+1])) - box_area.append(area) + if x0_str > 0 and y0_str > 0 and x1_str > 0 and y1_str > 0: + x0 = math.isnan(float(data['bounding_box'][(6*i)+0])) + y0 = math.isnan(float(data['bounding_box'][(6*i)+1])) + x1 = math.isnan(float(data['bounding_box'][(6*i)+2])) + y1 = math.isnan(float(data['bounding_box'][(6*i)+3])) + + if not x0 and not x1 and not y0 and not y1: + temp_tuple = (float(data['bounding_box'][(6*i)+0]), float(data['bounding_box'][(6*i)+1]), float(data['bounding_box'][(6*i)+2]), float(data['bounding_box'][(6*i)+3])) + box_coords.append(temp_tuple) + + area = (float(data['bounding_box'][(6*i)+2]) - float(data['bounding_box'][(6*i)+0])) * (float(data['bounding_box'][(6*i)+3]) - float(data['bounding_box'][(6*i)+1])) + box_area.append(area) + else: + box_area = [] + box_coords = [] + continue else: box_area = [] box_coords = [] diff --git a/src/webapp/TrainImage_Annotate/Annotate/views.pyc b/src/webapp/TrainImage_Annotate/Annotate/views.pyc index 48eea57..47ec5de 100644 Binary files a/src/webapp/TrainImage_Annotate/Annotate/views.pyc and b/src/webapp/TrainImage_Annotate/Annotate/views.pyc differ