Image processing

Image processing

For a Visual AI model using images as features, is there a way to combine 2 or more image features (e.g., feat1, feat2) into 1 feature, for use in the model blueprint?

For example, if I split a photo of a building into part1 and part2, can I stitch part1 and part2 back into 1 photo within a blueprint task? 

0 Kudos
4 Replies
DataRobot Employee
DataRobot Employee


I think you can use python code to combine images to any shape you want then input to Visual AI.

sample code here

import cv2

import numpy as np

image1 = cv2.cvtColor(image1_path, cv2.COLOR_BGR2RGB)

image1 = cv2.resize(image1, (size/2, size))

image2 = cv2.cvtColor(image2_path, cv2.COLOR_BGR2RGB)

image2 = cv2.resize(image2, (size/2, size))

outputImage = np.zeros((size, size, 3))

outputImage[0:size/2, 0:size] = image1

outputImage[size/2:size, 0:size] = image2

cv2.imwrite(output_path, outputImage)
0 Kudos

To clarify, I want to combine 2 image features within DataRobot. For example, using a custom blueprint. It appears the code you shared would run before loading any data into Datarobot.

I would like the code to run within DataRobot.

0 Kudos

If you would like to customize a blueprint to perform your own feature engineering then that would be within your own control, as alluded to by @senkin13 


I hope that helps you in your task.

0 Kudos
DataRobot Alumni

@SamW, just adding to what Desmond noted, you can take code like the sample provided and make a custom task out of it. Then you can embed that task in the blueprint to achieve what you're going for here. 

In the blueprint modification editor (when you click "Copy and edit" on a blueprint), you can hover over tasks to see their input and output schemas. This will help determine what data is coming out, and what format needs to be passed on. 

0 Kudos