Browse Source

some update

Jozef Mlich 2 years ago
parent
commit
487e7b742a
2 changed files with 10 additions and 10 deletions
  1. 6 7
      hogsvm.py
  2. 4 3
      test_hogsvm.sh

+ 6 - 7
hogsvm.py

@@ -24,7 +24,7 @@ def hog(img):
 ## [hog]
 
 def color_histogram(img):
-    bins_per_color = 64
+    bins_per_color = 128
     chans = cv.split(img)
     colors = ("b", "g", "r")
     features = []
@@ -83,7 +83,6 @@ if __name__ == '__main__':
             if img is None:
                 raise Exception("Error: file {} is not image".format(img_filename))
 
-#            cells.append(hog(img))
             cells.append(feature_vector(img));
             if not anot in classes:
                 classes.append(anot)
@@ -118,16 +117,16 @@ if __name__ == '__main__':
     test_data = np.float32(test_cells).reshape(-1,feature_shape )
 
     svm = cv.ml.SVM_create()
-    svm.setKernel(cv.ml.SVM_LINEAR)
-#    svm.setKernel(cv.ml.SVM_RBF)
+#    svm.setKernel(cv.ml.SVM_LINEAR)
+    svm.setKernel(cv.ml.SVM_RBF)
 
     svm.setType(cv.ml.SVM_C_SVC)
 
-#    svm.setC(2.67)
-#    svm.setGamma(5.383)
+    svm.setC(2.67)
+    svm.setGamma(5.383)
 
 
-    print("c = {0}; gamma = {1}; isTrained = {2}".format(svm.getC(), svm.getGamma(), svm.isTrained()))
+#    print("c = {0}; gamma = {1}; isTrained = {2}".format(svm.getC(), svm.getGamma(), svm.isTrained()))
 
     # train_data.shape = (2500,feature_shape), responses.shape: (2500, 1)
 #    svm.train(train_data, cv.ml.ROW_SAMPLE, train_anot)

+ 4 - 3
test_hogsvm.sh

@@ -1,9 +1,9 @@
 #!/bin/bash
 
-DATASET_SIZE=125
+#DATASET_SIZE=125
 #DATASET_SIZE=500
 #DATASET_SIZE=1000
-#DATASET_SIZE=5000
+DATASET_SIZE=5000
 #DATASET_SIZE=25446
 #DATASET_SIZE=125240
 #DATASET_SIZE=150686
@@ -33,7 +33,8 @@ if [ "$PREPARE_DATASET" = 1 ]; then
         cp "./anot.$DATASET_SIZE.txt" "./anot.txt"
     else
 
-        positive_dirs="/var/www/html/fire/labelme_samples-80/"
+#        positive_dirs="/var/www/html/fire/labelme_samples-80/"
+        positive_dirs="/var/www/html/fire/labelme_samples-100/"
 #        positive_dirs="/var/www/html/fire/labelme_samples-center/"