You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I made a custom plugin with 2 inputs of type ikomia.dataprocess.CImageIO().
I tried to set both inputs this way:
fromikomia.dataprocess.workflowimportWorkflowimportnumpyasnp# Init your workflowwf=Workflow()
img=np.random.randint(0, 256, (400, 400, 3), dtype=np.uint8)
mask=np.random.randint(0, 256, (400, 400, 1), dtype=np.uint8)
plugin=wf.add_task(name="test_plugin", auto_connect=True)
wf.set_image_input(array=img, index=0)
wf.set_image_input(array=mask, index=1) #this line does nothingwf.run()
Only the input of index 0 has been passed to the workflow.
A correct way of filling the input 1 of my plugin would have been :
fromikomia.dataprocess.workflowimportWorkflowimportnumpyasnp# Init your workflowwf=Workflow()
img=np.random.randint(0, 256, (400, 400, 3), dtype=np.uint8)
mask=np.random.randint(0, 256, (400, 400, 1), dtype=np.uint8)
plugin=wf.add_task(name="test_plugin", auto_connect=False)
wf.connect_tasks(wf.root(), plugin, [(0,0), (1,1)])
wf.set_image_input(array=img, index=0)
wf.set_image_input(array=mask, index=1) #this time it will set the input correctlywf.run()
The first code did not work as expected because auto_connect=True linked root with the plugin test_plugin. But root has by default only 1 input, so when wf.set_image_input is called, it can only set input for index 0.
The good way is to disable auto_connect and make connections between tasks with wf.connect_tasks.
To put it in a nutshell, the behavior of auto_connect=True is not explained and can lead to unexpected mistakes.
The text was updated successfully, but these errors were encountered:
I made a custom plugin with 2 inputs of type ikomia.dataprocess.CImageIO().
I tried to set both inputs this way:
Only the input of index 0 has been passed to the workflow.
A correct way of filling the input 1 of my plugin would have been :
The first code did not work as expected because auto_connect=True linked root with the plugin test_plugin. But root has by default only 1 input, so when wf.set_image_input is called, it can only set input for index 0.
The good way is to disable auto_connect and make connections between tasks with wf.connect_tasks.
To put it in a nutshell, the behavior of auto_connect=True is not explained and can lead to unexpected mistakes.
The text was updated successfully, but these errors were encountered: