{
  "id": 16276,
  "title": "Training Image Labeller app",
  "url": "/competitions/noaa-right-whale-recognition/discussion/16276",
  "author_name": "",
  "post_date": "2015-09-01T22:27:11.240Z",
  "votes": 1,
  "comment_count": 18,
  "views": 6314,
  "content": "<p>This is kinda embarrassing: can anybody explain to me how do I export the ROI as an .xml file? I only managed to dump the results into a Matlab object via the &quot;export ROI&quot; button.</p>",
  "messages": [
    {
      "id": "91276",
      "postDate": "09/01/2015 22:27:11",
      "content": "<p>This is kinda embarrassing: can anybody explain to me how do I export the ROI as an .xml file? I only managed to dump the results into a Matlab object via the &quot;export ROI&quot; button.</p>",
      "rawMarkdown": "This is kinda embarrassing: can anybody explain to me how do I export the ROI as an .xml file? I only managed to dump the results into a Matlab object via the \"export ROI\" button.",
      "votes": null
    },
    {
      "id": "91286",
      "postDate": "09/02/2015 00:06:10",
      "content": "<p>Struggling with the same!</p>",
      "rawMarkdown": "Struggling with the same!",
      "votes": null
    },
    {
      "id": "91293",
      "postDate": "09/02/2015 01:25:37",
      "content": "<p>The .xml file in the example shown is generated after training the &quot;face detector&quot; the MATLAB object that gets exported uby clicking the &quot;export ROI&quot; button is one of the inputs to the function that generates the xml file ( trainCascadeObjectDetector). </p>",
      "rawMarkdown": "The .xml file in the example shown is generated after training the \"face detector\" the MATLAB object that gets exported uby clicking the \"export ROI\" button is one of the inputs to the function that generates the xml file ( trainCascadeObjectDetector).",
      "votes": null
    },
    {
      "id": "91294",
      "postDate": "09/02/2015 01:43:54",
      "content": "<p>I think the tutorial <a href=\"https://www.kaggle.com/c/noaa-right-whale-recognition/details/creating-a-face-detector-for-whales\">Creating a &quot;Face Detector&quot; for Whales</a> might have some errors. The .XML file should be exported in step (3) rather than step (1).  Also, I went through the steps (1~3) and got the error message: &quot;Error using trainCascadeObjectDetector. Too many output arguments. &quot;</p>\n\n<p>With slight modifications, below is what works for me:</p>\n\n<p>Step  (1),  same as the tutorial. Click the &quot;export ROI&quot; button, export to a variable called <strong>positiveInstances</strong>. </p>\n\n<p>Step  (2), same as the tutorial. Also move all negative images to a folder called <strong>negativeFolder</strong>.</p>\n\n<p>Step (3),  train the detector.  Use the following code (reference: <a href=\"http://www.mathworks.com/help/vision/ref/traincascadeobjectdetector.html\">trainCascadeObjectDetector</a>) :</p>\n\n<p><strong>trainCascadeObjectDetector('detectorFile.xml', positiveInstances, 'negativeFolder', 'NumCascadeStages',15,'FalseAlarmRate',0.01,'FeatureType','LBP');</strong></p>\n\n<p><strong>WhaleDetectorMdl = vision.CascadeObjectDetector('detectorFile.xml')</strong></p>",
      "rawMarkdown": "I think the tutorial [Creating a \"Face Detector\" for Whales][1] might have some errors. The .XML file should be exported in step (3) rather than step (1).  Also, I went through the steps (1~3) and got the error message: \"Error using trainCascadeObjectDetector. Too many output arguments. \"\r\n\r\nWith slight modifications, below is what works for me:\r\n\r\nStep  (1),  same as the tutorial. Click the \"export ROI\" button, export to a variable called **positiveInstances**. \r\n\r\nStep  (2), same as the tutorial. Also move all negative images to a folder called **negativeFolder**.\r\n\r\nStep (3),  train the detector.  Use the following code (reference: [trainCascadeObjectDetector][2]) :\r\n\r\n**trainCascadeObjectDetector('detectorFile.xml', positiveInstances, 'negativeFolder', 'NumCascadeStages',15,'FalseAlarmRate',0.01,'FeatureType','LBP');**\r\n\r\n**WhaleDetectorMdl = vision.CascadeObjectDetector('detectorFile.xml')**\r\n\r\n  [1]: https://www.kaggle.com/c/noaa-right-whale-recognition/details/creating-a-face-detector-for-whales\r\n  [2]: http://www.mathworks.com/help/vision/ref/traincascadeobjectdetector.html",
      "votes": null
    },
    {
      "id": "91371",
      "postDate": "09/02/2015 17:19:12",
      "content": "<p>@Nina Chen: Thanks a lot.</p>",
      "rawMarkdown": "Nina Chen: Thanks a lot.",
      "votes": null
    },
    {
      "id": "91404",
      "postDate": "09/02/2015 19:51:16",
      "content": "<p>According to <a href=\"http://www.mathworks.com/help/vision/ug/label-images-for-classification-model-training.html\">this tutorial</a> the negative folder contains those images that do not contain the object in question. But isn't it the case that all of the images contain a whale? So there should not be any negatives right?</p>",
      "rawMarkdown": "According to [this tutorial](http://www.mathworks.com/help/vision/ug/label-images-for-classification-model-training.html) the negative folder contains those images that do not contain the object in question. But isn't it the case that all of the images contain a whale? So there should not be any negatives right?",
      "votes": null
    },
    {
      "id": "91409",
      "postDate": "09/02/2015 20:47:54",
      "content": "<p>@Kevin Burnham: The second part of the tutorial crops out the top left (I think) part of each image to give you negative images of just water. Maybe the occasional whale part will get in the images, but from what I've seen it did an ok job. </p>",
      "rawMarkdown": "Kevin Burnham: The second part of the tutorial crops out the top left (I think) part of each image to give you negative images of just water. Maybe the occasional whale part will get in the images, but from what I've seen it did an ok job.",
      "votes": null
    },
    {
      "id": "91411",
      "postDate": "09/02/2015 20:59:11",
      "content": "<p>Thanks Florian. I see that now. </p>",
      "rawMarkdown": "Thanks Florian. I see that now.",
      "votes": null
    },
    {
      "id": "91490",
      "postDate": "09/03/2015 14:43:24",
      "content": "<p>Follow-up: I managed to get the app to work, but the results with default settings (given in the starter code) are far from perfect - images get scaled to ~ 30x40, and subsequently a flood of false positives.\nCurious what experiences others had, in particular: did you find parameter settings allowing for reasonable results? One thing that helped me was dropping</p>\n\n<pre><code>'FeatureType','LBP'\n</code></pre>\n\n<p>from the function call so that default type is used instead - it still has lots of FP, but 5 extras instead of hundreds...</p>",
      "rawMarkdown": "Follow-up: I managed to get the app to work, but the results with default settings (given in the starter code) are far from perfect - images get scaled to ~ 30x40, and subsequently a flood of false positives.\r\nCurious what experiences others had, in particular: did you find parameter settings allowing for reasonable results? One thing that helped me was dropping\r\n\r\n    'FeatureType','LBP'\r\n\r\nfrom the function call so that default type is used instead - it still has lots of FP, but 5 extras instead of hundreds...",
      "votes": null
    },
    {
      "id": "91618",
      "postDate": "09/04/2015 22:35:04",
      "content": "<p>I too have got the starter code to work using the same approach described by Nina Chen.  I created negatives from the top left corner (outside the ROI) of the labeled images and saved them to a separate folder.</p>\n\n<p>However, using 100 images to train the detector, then testing the detector on a single image I get a 29x4 matrix returned, i.e. I'm assuming I interpret this as 29 ROI's of 'detected' whales (obviously false positives).</p>\n\n<p>Does anyone have an idea of how many training samples is required to train a stable detector?  I'm assuming I targeting a single ROI per image when using the detector to detect a whale?</p>",
      "rawMarkdown": "I too have got the starter code to work using the same approach described by Nina Chen.  I created negatives from the top left corner (outside the ROI) of the labeled images and saved them to a separate folder.\r\n\r\nHowever, using 100 images to train the detector, then testing the detector on a single image I get a 29x4 matrix returned, i.e. I'm assuming I interpret this as 29 ROI's of 'detected' whales (obviously false positives).\r\n\r\nDoes anyone have an idea of how many training samples is required to train a stable detector?  I'm assuming I targeting a single ROI per image when using the detector to detect a whale?",
      "votes": null
    },
    {
      "id": "91621",
      "postDate": "09/04/2015 22:46:27",
      "content": "<p>@Matt Wenger: exactly same as my problem, then. what helped a bit in my case (3 FP instead of 100s) was increasing the size that images are supposed to be rescaled to. It seems to me like this might be super sensitive to the &quot;quality&quot; of ROI you select...</p>",
      "rawMarkdown": "Matt Wenger: exactly same as my problem, then. what helped a bit in my case (3 FP instead of 100s) was increasing the size that images are supposed to be rescaled to. It seems to me like this might be super sensitive to the \"quality\" of ROI you select...",
      "votes": null
    },
    {
      "id": "91633",
      "postDate": "09/05/2015 05:20:52",
      "content": "<p>I've got a lot of false positives too ...</p>\n\n<p>For clarification: In my previous post when I wrote the code &quot;works for me&quot;, I only meant that the code no longer produce error messages, not that it produces a good detector. (I hope I didn't mislead anyone.)</p>",
      "rawMarkdown": "I've got a lot of false positives too ...\r\n\r\nFor clarification: In my previous post when I wrote the code \"works for me\", I only meant that the code no longer produce error messages, not that it produces a good detector. (I hope I didn't mislead anyone.)",
      "votes": null
    },
    {
      "id": "91720",
      "postDate": "09/06/2015 17:44:09",
      "content": "<p>@ Konrad Banachewicz: Any idea why the rescale size has an impact on detector accuracy?  It seems the defaul is 'auto' and this resizes to the median of the object size in the positive images.  I'm assuming this is the median of the ROI's as defined by the labeling app.</p>\n\n<p>From the help files it states: &quot;For optimal detection accuracy, specify an object training size close to the expected size of the object in the image.&quot;  I would expect the median object size to approximate this.</p>\n\n<p>I'm new to image processing, so any pointers on what characteristics dictate the 'quality' of an ROI would be helpful.  Thanks!</p>\n\n<p>@ Nina Chen: Thanks for the pointer on other detection approaches!</p>",
      "rawMarkdown": "Konrad Banachewicz: Any idea why the rescale size has an impact on detector accuracy?  It seems the defaul is 'auto' and this resizes to the median of the object size in the positive images.  I'm assuming this is the median of the ROI's as defined by the labeling app.\r\n\r\nFrom the help files it states: \"For optimal detection accuracy, specify an object training size close to the expected size of the object in the image.\"  I would expect the median object size to approximate this.\r\n\r\nI'm new to image processing, so any pointers on what characteristics dictate the 'quality' of an ROI would be helpful.  Thanks!\r\n\r\n@ Nina Chen: Thanks for the pointer on other detection approaches!",
      "votes": null
    },
    {
      "id": "91786",
      "postDate": "09/07/2015 18:03:05",
      "content": "<p>@Matt Wenger: no, no clue - but i am kind of new to image processing... I also understood it was the median, but clearly this means the size within the sample i created are all over the place.</p>",
      "rawMarkdown": "Matt Wenger: no, no clue - but i am kind of new to image processing... I also understood it was the median, but clearly this means the size within the sample i created are all over the place.",
      "votes": null
    },
    {
      "id": "98258",
      "postDate": "11/05/2015 12:30:56",
      "content": "<p>I have a question and I will be so grateful if somebody can ask me. After training my &quot;trainCascadeObjectDetector&quot; how can I use it to detect whales in the other images of the data set?</p>\n\n<p>Thank you a lot!!</p>",
      "rawMarkdown": "I have a question and I will be so grateful if somebody can ask me. After training my \"trainCascadeObjectDetector\" how can I use it to detect whales in the other images of the data set?\r\n\r\nThank you a lot!!",
      "votes": null
    },
    {
      "id": "98397",
      "postDate": "11/07/2015 15:54:17",
      "content": "<p>see <a href=\"http://www.mathworks.com/help/vision/ref/vision.cascadeobjectdetector-class.html\">this page</a>\nCreate a detector object.\n    faceDetector = vision.CascadeObjectDetector;</p>\n\n<p>Read input image.\n    I = imread('visionteam.jpg');</p>\n\n<p>Detect faces.\n    bboxes = step(faceDetector, I);</p>\n\n<p>Annotate detected faces.\n   IFaces = insertObjectAnnotation(I, 'rectangle', bboxes, 'Face');\n   figure, imshow(IFaces), title('Detected faces');</p>",
      "rawMarkdown": "see [this page][1]\r\nCreate a detector object.\r\n    faceDetector = vision.CascadeObjectDetector;\r\n\r\nRead input image.\r\n    I = imread('visionteam.jpg');\r\n\r\nDetect faces.\r\n    bboxes = step(faceDetector, I);\r\n\r\nAnnotate detected faces.\r\n   IFaces = insertObjectAnnotation(I, 'rectangle', bboxes, 'Face');\r\n   figure, imshow(IFaces), title('Detected faces');\r\n\r\n\r\n  [1]: http://www.mathworks.com/help/vision/ref/vision.cascadeobjectdetector-class.html",
      "votes": null
    },
    {
      "id": "98654",
      "postDate": "11/11/2015 18:26:44",
      "content": "<p>Hi, if anyone gets decent result with Training Image Labeller app, how many images/ROIs have you hand labelled?  Thank you!</p>\n\n<p>I labelled 47 positives and it will automatically choose 2x, 94 negatives but the result is really really bad, like what @Konrad Banachewicz had..</p>",
      "rawMarkdown": "Hi, if anyone gets decent result with Training Image Labeller app, how many images/ROIs have you hand labelled?  Thank you!\r\n\r\nI labelled 47 positives and it will automatically choose 2x, 94 negatives but the result is really really bad, like what @Konrad Banachewicz had..",
      "votes": null
    },
    {
      "id": "125061",
      "postDate": "06/25/2016 08:47:40",
      "content": "<p>I am making a Fire detection system ...I have exported the negative n positive instances variable into Matlab workspace but I am not sure how to proceed further...? Any ideas?</p>",
      "rawMarkdown": "I am making a Fire detection system ...I have exported the negative n positive instances variable into Matlab workspace but I am not sure how to proceed further...? Any ideas?",
      "votes": null
    },
    {
      "id": "125062",
      "postDate": "06/25/2016 08:50:17",
      "content": "<p>I want to detect fire from live video feed of my laptop's webcam </p>",
      "rawMarkdown": "I want to detect fire from live video feed of my laptop's webcam",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 91286,
      "author_name": "ashwinm",
      "author_url": "",
      "post_date": "09/02/2015 00:06:10",
      "content": "<p>Struggling with the same!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 91293,
      "author_name": "anehemia",
      "author_url": "",
      "post_date": "09/02/2015 01:25:37",
      "content": "<p>The .xml file in the example shown is generated after training the &quot;face detector&quot; the MATLAB object that gets exported uby clicking the &quot;export ROI&quot; button is one of the inputs to the function that generates the xml file ( trainCascadeObjectDetector). </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 91294,
      "author_name": "ncchen",
      "author_url": "",
      "post_date": "09/02/2015 01:43:54",
      "content": "<p>I think the tutorial <a href=\"https://www.kaggle.com/c/noaa-right-whale-recognition/details/creating-a-face-detector-for-whales\">Creating a &quot;Face Detector&quot; for Whales</a> might have some errors. The .XML file should be exported in step (3) rather than step (1).  Also, I went through the steps (1~3) and got the error message: &quot;Error using trainCascadeObjectDetector. Too many output arguments. &quot;</p>\n\n<p>With slight modifications, below is what works for me:</p>\n\n<p>Step  (1),  same as the tutorial. Click the &quot;export ROI&quot; button, export to a variable called <strong>positiveInstances</strong>. </p>\n\n<p>Step  (2), same as the tutorial. Also move all negative images to a folder called <strong>negativeFolder</strong>.</p>\n\n<p>Step (3),  train the detector.  Use the following code (reference: <a href=\"http://www.mathworks.com/help/vision/ref/traincascadeobjectdetector.html\">trainCascadeObjectDetector</a>) :</p>\n\n<p><strong>trainCascadeObjectDetector('detectorFile.xml', positiveInstances, 'negativeFolder', 'NumCascadeStages',15,'FalseAlarmRate',0.01,'FeatureType','LBP');</strong></p>\n\n<p><strong>WhaleDetectorMdl = vision.CascadeObjectDetector('detectorFile.xml')</strong></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 91371,
      "author_name": "konradb",
      "author_url": "",
      "post_date": "09/02/2015 17:19:12",
      "content": "<p>@Nina Chen: Thanks a lot.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 91404,
      "author_name": "kburnham",
      "author_url": "",
      "post_date": "09/02/2015 19:51:16",
      "content": "<p>According to <a href=\"http://www.mathworks.com/help/vision/ug/label-images-for-classification-model-training.html\">this tutorial</a> the negative folder contains those images that do not contain the object in question. But isn't it the case that all of the images contain a whale? So there should not be any negatives right?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 91409,
      "author_name": "florianm",
      "author_url": "",
      "post_date": "09/02/2015 20:47:54",
      "content": "<p>@Kevin Burnham: The second part of the tutorial crops out the top left (I think) part of each image to give you negative images of just water. Maybe the occasional whale part will get in the images, but from what I've seen it did an ok job. </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 91411,
      "author_name": "kburnham",
      "author_url": "",
      "post_date": "09/02/2015 20:59:11",
      "content": "<p>Thanks Florian. I see that now. </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 91490,
      "author_name": "konradb",
      "author_url": "",
      "post_date": "09/03/2015 14:43:24",
      "content": "<p>Follow-up: I managed to get the app to work, but the results with default settings (given in the starter code) are far from perfect - images get scaled to ~ 30x40, and subsequently a flood of false positives.\nCurious what experiences others had, in particular: did you find parameter settings allowing for reasonable results? One thing that helped me was dropping</p>\n\n<pre><code>'FeatureType','LBP'\n</code></pre>\n\n<p>from the function call so that default type is used instead - it still has lots of FP, but 5 extras instead of hundreds...</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 91618,
      "author_name": "mattwenger",
      "author_url": "",
      "post_date": "09/04/2015 22:35:04",
      "content": "<p>I too have got the starter code to work using the same approach described by Nina Chen.  I created negatives from the top left corner (outside the ROI) of the labeled images and saved them to a separate folder.</p>\n\n<p>However, using 100 images to train the detector, then testing the detector on a single image I get a 29x4 matrix returned, i.e. I'm assuming I interpret this as 29 ROI's of 'detected' whales (obviously false positives).</p>\n\n<p>Does anyone have an idea of how many training samples is required to train a stable detector?  I'm assuming I targeting a single ROI per image when using the detector to detect a whale?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 91621,
      "author_name": "konradb",
      "author_url": "",
      "post_date": "09/04/2015 22:46:27",
      "content": "<p>@Matt Wenger: exactly same as my problem, then. what helped a bit in my case (3 FP instead of 100s) was increasing the size that images are supposed to be rescaled to. It seems to me like this might be super sensitive to the &quot;quality&quot; of ROI you select...</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 91633,
      "author_name": "ncchen",
      "author_url": "",
      "post_date": "09/05/2015 05:20:52",
      "content": "<p>I've got a lot of false positives too ...</p>\n\n<p>For clarification: In my previous post when I wrote the code &quot;works for me&quot;, I only meant that the code no longer produce error messages, not that it produces a good detector. (I hope I didn't mislead anyone.)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 91720,
      "author_name": "mattwenger",
      "author_url": "",
      "post_date": "09/06/2015 17:44:09",
      "content": "<p>@ Konrad Banachewicz: Any idea why the rescale size has an impact on detector accuracy?  It seems the defaul is 'auto' and this resizes to the median of the object size in the positive images.  I'm assuming this is the median of the ROI's as defined by the labeling app.</p>\n\n<p>From the help files it states: &quot;For optimal detection accuracy, specify an object training size close to the expected size of the object in the image.&quot;  I would expect the median object size to approximate this.</p>\n\n<p>I'm new to image processing, so any pointers on what characteristics dictate the 'quality' of an ROI would be helpful.  Thanks!</p>\n\n<p>@ Nina Chen: Thanks for the pointer on other detection approaches!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 91786,
      "author_name": "konradb",
      "author_url": "",
      "post_date": "09/07/2015 18:03:05",
      "content": "<p>@Matt Wenger: no, no clue - but i am kind of new to image processing... I also understood it was the median, but clearly this means the size within the sample i created are all over the place.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 98258,
      "author_name": "pabloalicante",
      "author_url": "",
      "post_date": "11/05/2015 12:30:56",
      "content": "<p>I have a question and I will be so grateful if somebody can ask me. After training my &quot;trainCascadeObjectDetector&quot; how can I use it to detect whales in the other images of the data set?</p>\n\n<p>Thank you a lot!!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 98397,
      "author_name": "vincenthui",
      "author_url": "",
      "post_date": "11/07/2015 15:54:17",
      "content": "<p>see <a href=\"http://www.mathworks.com/help/vision/ref/vision.cascadeobjectdetector-class.html\">this page</a>\nCreate a detector object.\n    faceDetector = vision.CascadeObjectDetector;</p>\n\n<p>Read input image.\n    I = imread('visionteam.jpg');</p>\n\n<p>Detect faces.\n    bboxes = step(faceDetector, I);</p>\n\n<p>Annotate detected faces.\n   IFaces = insertObjectAnnotation(I, 'rectangle', bboxes, 'Face');\n   figure, imshow(IFaces), title('Detected faces');</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 98654,
      "author_name": "jiweiliu",
      "author_url": "",
      "post_date": "11/11/2015 18:26:44",
      "content": "<p>Hi, if anyone gets decent result with Training Image Labeller app, how many images/ROIs have you hand labelled?  Thank you!</p>\n\n<p>I labelled 47 positives and it will automatically choose 2x, 94 negatives but the result is really really bad, like what @Konrad Banachewicz had..</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 125061,
      "author_name": "marinashaheen",
      "author_url": "",
      "post_date": "06/25/2016 08:47:40",
      "content": "<p>I am making a Fire detection system ...I have exported the negative n positive instances variable into Matlab workspace but I am not sure how to proceed further...? Any ideas?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 125062,
      "author_name": "marinashaheen",
      "author_url": "",
      "post_date": "06/25/2016 08:50:17",
      "content": "<p>I want to detect fire from live video feed of my laptop's webcam </p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "91276": "This is kinda embarrassing: can anybody explain to me how do I export the ROI as an .xml file? I only managed to dump the results into a Matlab object via the \"export ROI\" button.",
    "91286": "Struggling with the same!",
    "91293": "The .xml file in the example shown is generated after training the \"face detector\" the MATLAB object that gets exported uby clicking the \"export ROI\" button is one of the inputs to the function that generates the xml file ( trainCascadeObjectDetector).",
    "91294": "I think the tutorial [Creating a \"Face Detector\" for Whales][1] might have some errors. The .XML file should be exported in step (3) rather than step (1).  Also, I went through the steps (1~3) and got the error message: \"Error using trainCascadeObjectDetector. Too many output arguments. \"\r\n\r\nWith slight modifications, below is what works for me:\r\n\r\nStep  (1),  same as the tutorial. Click the \"export ROI\" button, export to a variable called **positiveInstances**. \r\n\r\nStep  (2), same as the tutorial. Also move all negative images to a folder called **negativeFolder**.\r\n\r\nStep (3),  train the detector.  Use the following code (reference: [trainCascadeObjectDetector][2]) :\r\n\r\n**trainCascadeObjectDetector('detectorFile.xml', positiveInstances, 'negativeFolder', 'NumCascadeStages',15,'FalseAlarmRate',0.01,'FeatureType','LBP');**\r\n\r\n**WhaleDetectorMdl = vision.CascadeObjectDetector('detectorFile.xml')**\r\n\r\n  [1]: https://www.kaggle.com/c/noaa-right-whale-recognition/details/creating-a-face-detector-for-whales\r\n  [2]: http://www.mathworks.com/help/vision/ref/traincascadeobjectdetector.html",
    "91371": "Nina Chen: Thanks a lot.",
    "91404": "According to [this tutorial](http://www.mathworks.com/help/vision/ug/label-images-for-classification-model-training.html) the negative folder contains those images that do not contain the object in question. But isn't it the case that all of the images contain a whale? So there should not be any negatives right?",
    "91409": "Kevin Burnham: The second part of the tutorial crops out the top left (I think) part of each image to give you negative images of just water. Maybe the occasional whale part will get in the images, but from what I've seen it did an ok job.",
    "91411": "Thanks Florian. I see that now.",
    "91490": "Follow-up: I managed to get the app to work, but the results with default settings (given in the starter code) are far from perfect - images get scaled to ~ 30x40, and subsequently a flood of false positives.\r\nCurious what experiences others had, in particular: did you find parameter settings allowing for reasonable results? One thing that helped me was dropping\r\n\r\n    'FeatureType','LBP'\r\n\r\nfrom the function call so that default type is used instead - it still has lots of FP, but 5 extras instead of hundreds...",
    "91618": "I too have got the starter code to work using the same approach described by Nina Chen.  I created negatives from the top left corner (outside the ROI) of the labeled images and saved them to a separate folder.\r\n\r\nHowever, using 100 images to train the detector, then testing the detector on a single image I get a 29x4 matrix returned, i.e. I'm assuming I interpret this as 29 ROI's of 'detected' whales (obviously false positives).\r\n\r\nDoes anyone have an idea of how many training samples is required to train a stable detector?  I'm assuming I targeting a single ROI per image when using the detector to detect a whale?",
    "91621": "Matt Wenger: exactly same as my problem, then. what helped a bit in my case (3 FP instead of 100s) was increasing the size that images are supposed to be rescaled to. It seems to me like this might be super sensitive to the \"quality\" of ROI you select...",
    "91633": "I've got a lot of false positives too ...\r\n\r\nFor clarification: In my previous post when I wrote the code \"works for me\", I only meant that the code no longer produce error messages, not that it produces a good detector. (I hope I didn't mislead anyone.)",
    "91720": "Konrad Banachewicz: Any idea why the rescale size has an impact on detector accuracy?  It seems the defaul is 'auto' and this resizes to the median of the object size in the positive images.  I'm assuming this is the median of the ROI's as defined by the labeling app.\r\n\r\nFrom the help files it states: \"For optimal detection accuracy, specify an object training size close to the expected size of the object in the image.\"  I would expect the median object size to approximate this.\r\n\r\nI'm new to image processing, so any pointers on what characteristics dictate the 'quality' of an ROI would be helpful.  Thanks!\r\n\r\n@ Nina Chen: Thanks for the pointer on other detection approaches!",
    "91786": "Matt Wenger: no, no clue - but i am kind of new to image processing... I also understood it was the median, but clearly this means the size within the sample i created are all over the place.",
    "98258": "I have a question and I will be so grateful if somebody can ask me. After training my \"trainCascadeObjectDetector\" how can I use it to detect whales in the other images of the data set?\r\n\r\nThank you a lot!!",
    "98397": "see [this page][1]\r\nCreate a detector object.\r\n    faceDetector = vision.CascadeObjectDetector;\r\n\r\nRead input image.\r\n    I = imread('visionteam.jpg');\r\n\r\nDetect faces.\r\n    bboxes = step(faceDetector, I);\r\n\r\nAnnotate detected faces.\r\n   IFaces = insertObjectAnnotation(I, 'rectangle', bboxes, 'Face');\r\n   figure, imshow(IFaces), title('Detected faces');\r\n\r\n\r\n  [1]: http://www.mathworks.com/help/vision/ref/vision.cascadeobjectdetector-class.html",
    "98654": "Hi, if anyone gets decent result with Training Image Labeller app, how many images/ROIs have you hand labelled?  Thank you!\r\n\r\nI labelled 47 positives and it will automatically choose 2x, 94 negatives but the result is really really bad, like what @Konrad Banachewicz had..",
    "125061": "I am making a Fire detection system ...I have exported the negative n positive instances variable into Matlab workspace but I am not sure how to proceed further...? Any ideas?",
    "125062": "I want to detect fire from live video feed of my laptop's webcam"
  },
  "source": "meta"
}