Some Tips on Improving Detection Accuracy¶
Pixy's color filtering algorithm can process an entire frame in 20 ms (50 times a second). But discrimination can sometimes be a problem -- false positives and false negatives. False positives are when Pixy thinks an object matches a particular signature, but it's not the object you want to detect. It's often an object with a similar hue. For example, Pixy thinks your light green shirt matches a green ball. False negatives are when Pixy fails to detect an object that you intended to detect with a particular signature.
Let's go through adjustments you can make to improve Pixy's detection accuracy.
Signature range tuning is probably the most effective method to improve detection accuracy. Bring up the Configure dialog (click on the gear icon or select File➜Configure). Now select the Signature Tuning tab under Pixy Parameters (it should be the first pan you see when you bring up the Configuration Dialog).
Use the slider for Signature 1 range to adjust the inclusiveness of signature 1 (assuming it's signature 1 you're wanting to adjust). Slide it to the left if you want to be less inclusive (i.e. you're seeing false positives, like the picture below):
or slide it to the right if you want to be more inclusive (i.e. you're seeing false negatives) or the detection is intermittent or sparse (like in the picture below):
Choose a slider value that provides good strong detection like the picture below:
You can adjust all seven color signatures this way to maximize detection accuracy. Be sure to press Apply or OK to save the slider ranges! The adjusted values won't be saved if you press Cancel or dismiss the dialog.
Enabling overexposure highlighting and adjusting camera brightness/exposure¶
Like a camera, Pixy needs to get the correct exposure setting or its images won't contain enough dynamic range, and detection accuracy will suffer. PixyMon has a feature that highlights regions of the image that are overexposed. You can enable it by clicking on the box next to Highlight overexposure in the PixyMon Parameters tab (see below).
When this is enabled, overexposed parts of the image will be highlighted as black, as shown below:
We highly recommend enabling overexposure highlighting, because if the object you want to detect is overexposed, detection accuracy will suffer. So, after enabling overexposure highlighting, go to the Signature Tuning tab in Pixy Parameters and choose a good setting for Camera Brightness by adjusting the slider (see below).
A good exposure setting leaves almost all of the pixels in your object correctly exposed, but not too dark (underexposed). It's OK for small parts of your object to be overexposed, especially if your object is shiny. See the picture below -- note that a small part of the object (yellow ball) has a black region indicating overexposure. This is fine.
Adjust minimum brightness¶
The Min brightness slider in the Signature Tuning tab sets a minimum brightness setting for all signatures. That is, if a pixel is below the minimum brightness setting it won't be considered as part of any color signature. So if you are seeing false positives that are sufficiently dark, you can adjust the Min brightness setting higher to reduce the false positives. If you are not able to detect objects that are sufficiently dark, you can adjust the Min brightness setting lower to reduce the false negatives.
Use the mouse to teach Pixy your object¶
There are two ways to teach Pixy an object: the button-press method and the mouse-select method. They are both described here. The mouse-select method makes sure that no unintended pixels make it into the teaching set when making a color signature.
Adjust the signature teach threshold¶
One of Pixy's goals is to be able to easily learn different objects without needing to hook it up to a computer. The button-press teaching method allows you to do this. But for certain objects and/or lighting conditions, the button-press method might need some adjusting. The Signature teach threshold setting in the Expert tab allows you to adjust how inclusive Pixy is when determining which pixels are part of the object during teaching. You can adjust the Signature teach threshold while Pixy is in teach mode, so you can get "live" feedback while choosing a good threshold. The video below shows the Signature teach threshold in action.
The picture below is an example of a threshold that is too inclusive. Note the regions that are not part of the purple dinosaur (the intended object). In this case, you should reduce the threshold.
The picture below is an example of a threshold that is not inclusive enough. Note that the regions do not include much of the purple dinosuar. In this case, you should increase the threshold.