inspirit / jsfeat

JavaScript Computer Vision library.
MIT License
2.74k stars 372 forks source link

Question : Creating cascaded for HAAR Cascades object detector #35

Open pksorensen opened 9 years ago

pksorensen commented 9 years ago

I am amazed by this library. My background is in computer vision and i would like to contribute to this library.

My first project would be something like creating tutorials for creating a cascade with opencv and then detect with it in web with this library.

Any ideas or pointers of anything that could be interesting to look at? (i am skilled in opencv and just need to get my head around the data structure in this library).

Maybe its something you already looked at.

inspirit commented 9 years ago

hi thanx for your interest. jsfeat impl of HAAR cascades is based on an old version of trainer from OpenCV and it is compatible to stump based classifiers. Classifiers for face, hand and eye detection are already included.

aferriss commented 9 years ago

Hi Eugene,

I'm also curious about how to convert an opencv haar cascade xml file into the jsfeat format. Do you have a conversion tool? I'd prefer not to retrain if possible since it takes so long. For instance my cascade looks like this

<?xml version="1.0"?>
<opencv_storage>
<cascade>
  <stageType>BOOST</stageType>
  <featureType>HAAR</featureType>
  <height>40</height>
  <width>80</width>
  <stageParams>
    <boostType>GAB</boostType>
    <minHitRate>9.9900001287460327e-01</minHitRate>
    <maxFalseAlarm>5.0000000000000000e-01</maxFalseAlarm>
    <weightTrimRate>9.4999999999999996e-01</weightTrimRate>
    <maxDepth>1</maxDepth>
    <maxWeakCount>100</maxWeakCount></stageParams>
  <featureParams>
    <maxCatCount>0</maxCatCount>
    <featSize>1</featSize>
    <mode>ALL</mode></featureParams>
  <stageNum>20</stageNum>
  <stages>
    <!-- stage 0 -->
    <_>
      <maxWeakCount>13</maxWeakCount>
      <stageThreshold>-1.0350964069366455e+00</stageThreshold>
      <weakClassifiers>
        <_>
          <internalNodes>
            0 -1 85 -1.3720529153943062e-02</internalNodes>
          <leafValues>
            5.0184500217437744e-01 -3.8205981254577637e-01</leafValues></_>
        <_>
          <internalNodes>
            0 -1 145 -1.1965321376919746e-02</internalNodes>
          <leafValues>
            -8.7071585655212402e-01 1.8524530529975891e-01</leafValues></_>
        <_>

and so on down to the features

  <features>
    <_>
      <rects>
        <_>
          0 0 78 40 -1.</_>
        <_>
          39 0 39 40 2.</_></rects>
      <tilted>0</tilted></_>

Any ideas? The cascade I have was created by following this guide: http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html

yuccai commented 8 years ago

Hi, In the same idea as the previous post, is it possible to convert haar cascade files from js-detect library for jsfeat ? If yes, could you please explain it to me ? I would like to detect nose thanks your library but the classifier doesn't exist yet.