项目作者: danhdoan

项目描述 :
Modified Viola-Jones algorithm for Face Detection. AdaBoost implementation from scratch. Fuzzy membership functions are utilized for classification
高级语言: Java
项目地址: git://github.com/danhdoan/AdaBoost-with-Fuzzy-MF.git
创建时间: 2018-05-08T07:28:50Z
项目社区:https://github.com/danhdoan/AdaBoost-with-Fuzzy-MF

开源协议:

下载


Analysis of Face Detection by AdaBoost algorithm using Fuzzy Membership

NetBean project:

  1. - fuzzy_gauss_19: implementation of AdaBoost with Gaussian Fuzzy MF on MIT cbcl dataset
  2. - 20180125_fuzzy_gauss1_19.wk
  3. - 20180125_fuzzy_gauss2_19.wk
  4. - 20180125_fuzzy_gauss3_19.wk
  5. - fuzzy_gauss_24: implementation of AdaBoost with Gaussian Fuzzy MF on Yi-qing dataset
  6. - 20180125_fuzzy_gauss1_24.wk
  7. - 20180125_fuzzy_gauss3_24.wk
  8. - fuzzy_tri_19: implementation of AdaBoost with Triangular Fuzzy MF on MIT cbcl dataset
  9. - 20180117_fuzzy_tri_std1_19.wk
  10. - 20180118_fuzzy_tri_std15_19.wk
  11. - 20180116_fuzzy_tri_std2_19.wk
  12. - 20180118_fuzzy_tri_std25_19.wk
  13. - 20180118_fuzzy_tri_std3_19.wk
  14. - fuzzy_tri_24: implementation of AdaBoost with Triangular Fuzzy MF on Yi-qing dataset
  15. - 20180119_fuzzy_tri_std1_24.wk
  16. - 20180119_fuzzy_tri_std15_24.wk
  17. - 20180117_fuzzy_tri_std2_24.wk
  18. - 20180119_fuzzy_tri_std25_24.wk
  19. - 20180119_fuzzy_tri_std3_24.wk
  20. - vj_thres_19: implementation of AdaBoost with Viola-Jones method on MIT cbcl dataset
  21. - 20171025_vj_5000_19.wk
  22. - vj_thres_24: implementation of AdaBoost with Viola-Jones method on Yi-qing dataset
  23. - 20171025_vj_24.wk
  24. Each Strongclass (.wk file) mentioned above consists of 200 Weakclass

Program structure:

  1. main
  2. |__ trainingProcess
  3. |__ testingProcess

Training Process:

  1. trainProcess
  2. |__ readInputImage
  3. |__ calculateIntegralImage
  4. |__ readTypePattern
  5. |__ readIndex
  6. |__ algorithmAdaboost
  7. |__ saveArrWeakClass

Functions:

  1. ArrayList<int[][]> readInputImage(String path)
  2. Parameter:
  3. - path: directory path to get input images
  4. Usage:
  5. - Read and pre-process input image
  6. Step:
  7. - Read images from given path
  8. - Convert to Grayscale (if using Yi-qing dataset with PNG image)
  9. - Normalize image
  10. - Return an ArrayList
  11. ArrayList<int[][]> calculateIntegralImage(ArrayList<int[][]> lstImg)
  12. Parameter:
  13. - lstImg: ArrayList of input image
  14. Usage:
  15. - Compute integral images
  16. Step:
  17. - Get Integral images and store in an ArrayList
  18. ArrayList<int[][]> readTypePattern(String path)
  19. Parameter:
  20. - path: directory path of color map
  21. Usage:
  22. - Read color map for each Haar-like pattern
  23. IndexObj[] readIndex(String path)
  24. Parameter:
  25. - path: directory path of feature index
  26. Usage:
  27. - Read all feature index from Lookup table
  28. WeakClass[] algorithmAdaboost()
  29. Usage:
  30. - Train Strongclass from given Integral images and Haar-like pattern
  31. - Each WeakClass is chosen from 5000 random features
  32. Step:
  33. - Initialize Weight for Face and Non-face samples
  34. - For each round:
  35. - Normalize Weights
  36. - Get Feature with smallest error
  37. - Calculate Alpha
  38. - Update Weights
  39. FeatureIndex getFeatureIndex_weights(double[] weights, int numPosTrain, int numNegTrain)
  40. Parameter:
  41. - weights: Weights of all face and non-face samples
  42. - numPosTrain: number of face samples
  43. - numNegTrain: number of non-face samples
  44. Usage:
  45. - Choose the Feature that yields the smallest error rate with given Weights for Face and Non-face
  46. Step:
  47. - Get K (=5000) random features
  48. - For each feature:
  49. - Get feature values for the whole set of samples
  50. - Calculate mean, variance, (standard deviation if Triangular Fuzzy MF) for each distribution
  51. - Calculate membership or compare for classification
  52. - Compute error to choose feature producing least error rate
  53. Boolean isPositiveDist(double meanPos, double varPos, double meanNeg, double varNeg, double val, double gamma)
  54. Parameter:
  55. - meanPos, varPos: mean and variance of Face distribution
  56. - meanNeg, varNeg: mean and variance of Non-face distribution
  57. Usage:
  58. - Compare density function to Face and Non-face distribution without directly calculating the function value
  59. Step:
  60. - Just simplify ratio of 2 density function formulas
  61. Note: only use for Gaussian Fuzzy MF
  62. double getMembershipTriangle(double min, double mean, double max, double val)
  63. Parametere:
  64. - min, max: minimum and maximum values of distribution
  65. - mean: mean of distribution
  66. - val: value to find the corresponding membership
  67. Usage:
  68. - Calculate membership of a value to a Triangular Fuzzy distribution
  69. Step:
  70. - Just apply Fuzzy MF formula
  71. Note: only use for Triangular Fuzzy MF

Test Process:

  1. trainProcess
  2. |__ readInputImage
  3. |__ calculateIntegralImage
  4. |__ readTypePattern
  5. |__ readIndex
  6. |__ loadWeakClass
  7. |__ testData

Functions:

  1. void testData(String fileTestInfo, double rate)
  2. Parameter:
  3. - fileTestInfo: file that contains information about the number of face and non-face for testing
  4. - rate: rate used for testing (instead of using 0.5 as in origin AdaBoost algorihtm)
  5. Usage:
  6. - Test StrongClass with given number of WeakClass and rate to find TPR, FPR
  7. Step:
  8. - For each test sample:
  9. - For each Weakclass
  10. - Calculate feature value
  11. - Calculate membership to classify
  12. - Classify face or non-face