Showing results for 
Search instead for 
Did you mean: 

Custom BP: How to add open CV's largest rectangle task

Custom BP: How to add open CV's largest rectangle task

Within the custom blueprints for Keras image models, how exactly do we use the Open CV Detect Largest Rectangle ? Specifically, I would like this image preprocessing task to extract out a roof from an aerial image before the model proceeds with the rest of the blueprint tasks. Not sure how to implement this  Open CV Detect Largest Rectangle in a  custom BP, or how to check the results.

3 Replies

To get the output of most any task in a blueprint--assuming you are in the cloud and/or have access to custom tasks as part of composable ML--you can embed a custom task inside the blueprint that both passes output along to the next task and makes it available for download. In the near future, we will include an example of this more generally here in the DR Community. For now, ask your friendly Customer Success Manager or Customer-facing Data Scientist for more information. 


Regarding some more details about the Open CV largest rectangle task. The OpenCV largest rectangle task may struggle to find rectangle because:


  • For images that include multiple rectangular shapes, the algorithm looks for one that has at least ~100x100 pixels (and not greatly skewed). There may be smaller rectangles in the image, but in the end we detect and return only 1.
  • In some cases, the user does not need the OpenCV largest detection algorithm. AutoPilot can sometimes do the job with our pre-trained convolutional neural networks (CNNs). They may be able to identify the rectangle of interest and get signal from the it during image classification/regression projects with Visual AI.

Thanks - is there anyway to inspect the output of the OPEN CV Detect Largest Rectangle ?

Note that I checked the activation map and image embeddings, and they still seem to show the entire image without any cropping/rectangles.

DataRobot Alumni

Here is the answer from my colleague
just after Image Variables, add via Composable ML search palette Detect Largest Rectangle task. The task itself detect largest rectangle and crops it (edited)