Navigate an agri-robot using the crops themselves as the guide via computer vision.
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
Screenshot from 2019-05-21 09-00-36.pngPortable Network Graphics (PNG) - 944.05 kB - 05/21/2019 at 08:14 |
|
|
Screenshot from 2019-05-21 09-07-08.pngPortable Network Graphics (PNG) - 1.12 MB - 05/21/2019 at 08:14 |
|
|
It's only taken me 2 months to work out how to get the camera working without buying a 4K monitor, mostly thanks to a reply on the Nvidia community forum, which is pretty fantastic.
#import "cudaResize.h" CUDA(cudaResizeRGBA((float4*)imgRGBA, camera->GetWidth(), camera->GetHeight(), (float4*)imgRGBA, texture->GetWidth(), texture->GetHeight()));
Place the above before "CUDA(cudaNormalizeRGBA()" in the draw section at the bottom of the main loop. In the section near the top where the code creates the display and texture, either set your texture size to a custom value or divide it by an amount that brings it into the size of your display properly. I divided the camera size by 2 for my needs.
texture = glTexture::Create(camera->GetWidth()/2, camera->GetHeight()/2, GL_RGBA32F_ARB/*GL_RGBA8*/);
The camera frame now needs to be split up into 6 grids for the new resolution and calculations made to take account of the perspective every time the camera is moving to a new position.
I spent a bit of time taking about 1,000 photos of some yellow plastic discs I had lying around to use as simulators of grids of plants in the workshop rather than out in a field.
This proved to be a great investment and has made testing the machine much easier.
BEFORE:
AFTER:
inline static bool rectOverlap(const float6& r1, const float6& r2)
{
// The rectangles do not overlap at all
if ( r2.x > r1.z || r2.z < r1.x ||
r2.y > r1.w ||
r2.w < r1.y ) return false;
else {
float overlap_x = std::min(r2.z,r1.z) - std::max(r2.x,r1.x);
float overlap_y = std::min(r2.w,r1.w) - std::max(r2.y,r1.y);
float area_overlap = overlap_x * overlap_y;
float area_r1 = (r1.z-r1.x) * (r1.w-r1.y);
float area_r2 = (r2.z-r2.x) * (r2.w-r2.y);
// The rectangles overlap by less than 75% of either's area
if ((area_overlap < 0.25*area_r1) && (area_overlap < 0.25*area_r2)) return false;
// The rectangels overlap
return true;
}
}
The plants are much larger now at this time in the season and there's a problem with the detection boxes coalescing:
After adding about 1,000 'labels' as described in the previous log, rather surprisingly, the detection now works very well in bright sunlight with strong shadows:
It's all about the number of labels, not the number of images. A proportion of the images should be close up, high resolution, but, quite possibly, a large number can be lower resolution, so I decided to include photographs of the seedlings in groups of 9 as below:
On a relatively small dataset of just 2064 images, we're already getting good results detecting swede plants. The boxes are not tight on the crops yet and this can probably be cured by adding a load of null images of the soil. Shadows are also a problem and additional images will probably be added with shadows to counter that.
350 swedelings have been planted. The weather is dry and hot. Each plant is exactly 11" apart to match the weeding pattern of the robot. A giant wooden set square and carefully placed string lines are used for positioning.
From experiences using computer vision last year, some of the cameras got very confused by bits of dry vegetable matter, particularly long thin bits, or 'straw' lying on the surface of the soil. The previous log shows a very scrappy plot, mainly due to this straw being turned over near the surface rather than buried. A pass with the plough turns the soil over to about 8" depth and should help bury the rubbish. The test plot is now left to dry out and any remaining weeds to get blasted by the strong sunlight we're getting at the moment:
Create an account to leave a comment. Already have an account? Log In.
Become a member to follow this project and never miss any updates