Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
vinay0410 committed Nov 9, 2017
1 parent 52f13df commit ac4e3bb
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 8 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added .readme_images/after_nms1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .readme_images/after_nms2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .readme_images/before_nms1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .readme_images/before_nms2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
# Coming Soon
# Pedestrian Detection

To test on images, simply run,
``` python detectmulti.py -i <path to image> ```

For more options run,
``` python detectmulti.py -h ```

```-d : Downscale ratio, is set to 1.25 by default```


![Alt text](/.readme_images/before_nms1.jpg?raw=true "Sample Results")
![Alt text](/.readme_images/after_nms1.jpg?raw=true "Sample Results")

![Alt text](/.readme_images/before_nms2.jpg?raw=true "Sample Results")
![Alt text](/.readme_images/after_nms2.jpg?raw=true "Sample Results")
39 changes: 34 additions & 5 deletions detectmulti.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ def appendRects(i, j, conf, c, rects):
parser = argparse.ArgumentParser(description='To read image name')

parser.add_argument('-i', "--image", help="Path to the test image", required=True)
parser.add_argument('-d','--downscale', help="Downscale ratio", default=1.25, type=int)
parser.add_argument('-d','--downscale', help="Downscale ratio", default=1.25, type=float)
parser.add_argument('-v', '--visualize', help="Visualize the sliding window", action="store_true")
parser.add_argument('-w', '--winstride', help="Pixels to move in one step, in any direction", default=8, type=int)
args = vars(parser.parse_args())


Expand All @@ -34,7 +35,7 @@ def appendRects(i, j, conf, c, rects):

scaleFactor = args["downscale"]
inverse = 1.0/scaleFactor
winStride = (10, 10)
winStride = (args["winstride"], args["winstride"])
winSize = (128, 64)

rects = []
Expand Down Expand Up @@ -64,7 +65,7 @@ def appendRects(i, j, conf, c, rects):
visual = gray.copy()
cv2.rectangle(visual, (j, i), (j+winSize[1], i+winSize[0]), (0, 0, 255), 2)
cv2.imshow("visual.jpg", visual)
cv2.waitKey(1)
cv2.waitKey(0)

if int(result[0]) == 1:
print (result, i, j)
Expand All @@ -82,7 +83,11 @@ def appendRects(i, j, conf, c, rects):

print rects

nms_rects = nms(rects, 0.3)
nms_rects_01 = nms(rects, 0.1)
nms_rects_02 = nms(rects, 0.2)
nms_rects_03 = nms(rects, 0.3)
nms_rects_04 = nms(rects, 0.4)
nms_rects_05 = nms(rects, 0.5)

for (a, b, conf, c, d) in rects:
cv2.rectangle(orig, (a, b), (a+c, b+d), (0, 255, 0), 2)
Expand All @@ -92,7 +97,31 @@ def appendRects(i, j, conf, c, rects):



for (a, b, conf, c, d) in nms_rects:
for (a, b, conf, c, d) in nms_rects_01:
cv2.rectangle(img, (a, b), (a+c, b+d), (0, 255, 0), 2)

cv2.imshow("After NMS", img)
cv2.waitKey(0)

for (a, b, conf, c, d) in nms_rects_02:
cv2.rectangle(img, (a, b), (a+c, b+d), (0, 255, 0), 2)

cv2.imshow("After NMS", img)
cv2.waitKey(0)

for (a, b, conf, c, d) in nms_rects_03:
cv2.rectangle(img, (a, b), (a+c, b+d), (0, 255, 0), 2)

cv2.imshow("After NMS", img)
cv2.waitKey(0)

for (a, b, conf, c, d) in nms_rects_04:
cv2.rectangle(img, (a, b), (a+c, b+d), (0, 255, 0), 2)

cv2.imshow("After NMS", img)
cv2.waitKey(0)

for (a, b, conf, c, d) in nms_rects_05:
cv2.rectangle(img, (a, b), (a+c, b+d), (0, 255, 0), 2)

cv2.imshow("After NMS", img)
Expand Down
Binary file added sample_images/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sklearn.externals import joblib
from skimage.feature import hog

clf = joblib.load('person_final.pkl')
clf = joblib.load('person_hard.pkl')
pos_img_dir = "test/pos/"
neg_img_dir = "test/neg/"

Expand Down
2 changes: 1 addition & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def hard_negative_mine(f_neg, winSize, winStride):
X_final = np.concatenate((X, hard_negatives))
Y_final = np.concatenate((Y, hard_negative_labels))

print "Final Samples: " str(len(X_final))
print "Final Samples: " + str(len(X_final))
print "Retraining the classifier with final data"

clf.fit(X_final, Y_final)
Expand Down

0 comments on commit ac4e3bb

Please sign in to comment.