# Module stuck in starting

**URL:** <https://community.bisque2.ece.ucsb.edu/t/module-stuck-in-starting/30>\
**Category:** Module Development\
**Created:** [April 2, 2025, 8:14pm UTC](https://community.bisque2.ece.ucsb.edu/t/module-stuck-in-starting/30 "2025-04-02T20:14:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![levensonlab](https://avatars.discourse-cdn.com/v4/letter/l/c4cdca/32.png) [@levensonlab](https://community.bisque2.ece.ucsb.edu/u/levensonlab)\
**Post date:** [April 2, 2025, 8:14pm UTC](https://community.bisque2.ece.ucsb.edu/t/module-stuck-in-starting/30/1 "2025-04-02T20:14:45Z")

</div>

Hi there,

I am developing a module which has a an image and associated gobject rectangle input. Currently the model gets stuck in “starting” phase when I click run. Here is my associated run\_module function:

import cv2  
import os

# input\_path\_dict will have input file paths with keys corresponding to the input names set in the cli.

import cv2  
import os

def run\_module(input\_path\_dict, output\_folder\_path, coordinates, min\_hysteresis=100, max\_hysteresis=200):  
“”"  
This function should load input resources from input\_path\_dict, do any pre-processing steps, run the algorithm,  
save all outputs to output\_folder\_path, AND return the outputs\_path\_dict.

:param input\_path\_dict: Dictionary of input resource paths indexed by input names.  
:param output\_folder\_path: Directory where to save output results.  
:param coordinates: Array with 4 values representing the crop rectangle [x1, y1, x2, y2].  
:param min\_hysteresis: Tunable parameter with a default value.  
:param max\_hysteresis: Tunable parameter with a default value.  
:return: Dictionary of output result paths.  
“”"

##### Preprocessing

# Get input file paths from dictionary

input\_img\_path = input\_path\_dict[‘Input Image’] # Ensure the key matches the CLI input name

# Load image in grayscale

img = cv2.imread(input\_img\_path, 0)

# Extract cropping coordinates

x1, y1, x2, y2 = coordinates  
print(x1, y1, x2, y2)

# Crop the image

cropped\_img = img[y1:y2, x1:x2]

##### Run algorithm

# Apply Canny edge detection

#edges\_detected = cv2.Canny(cropped\_img, min\_hysteresis, max\_hysteresis)

##### Save output

# Get filename without extension

input\_img\_name = os.path.splitext(os.path.basename(input\_img\_path))[0]

# Generate output file path

output\_img\_path = os.path.join(output\_folder\_path, f"{input\_img\_name}\_cropped\_edges.jpg")

# Save output image

cv2.imwrite(output\_img\_path, cropped\_img)

# Create dictionary of output paths

output\_paths\_dict = {‘Output Image’: output\_img\_path}

##### Return output paths dictionary

return output\_paths\_dict  
if name == ‘main’:

# Place some code to test implementation

# Define input\_path\_dict and output\_folder\_path

input\_path\_dict = {}  
current\_directory = os.getcwd()

# Place test image in current directory

input\_path\_dict[‘Input Image’] = os.path.join(current\_directory,‘test\_image.jpg’) # KEY MUST MATCH INPUT NAME SET IN CLI  
output\_folder\_path = current\_directory

# Run algorithm and return output\_paths\_dict

output\_paths\_dict = run\_module(input\_path\_dict, output\_folder\_path, min\_hysteresis=100, max\_hysteresis=200)

# Get outPUT file path from dictionary

output\_img\_path = output\_paths\_dict[‘Output Image’] # KEY MUST MATCH OUTPUT NAME SET IN CLI

# Load data

out\_img = cv2.imread(output\_img\_path, 0)

# Display output image and ensure correct output

#cv2.imshow(“Results”,out\_img)

---

<div class="post-metadata">

**Author:** ![connor11son](https://avatars.discourse-cdn.com/v4/letter/c/f08c70/32.png) [@connor11son](https://community.bisque2.ece.ucsb.edu/u/connor11son)\
**Post date:** [April 2, 2025, 8:52pm UTC](https://community.bisque2.ece.ucsb.edu/t/module-stuck-in-starting/30/2 "2025-04-02T20:52:13Z")

</div>

What log files can you see inside /source/staging/{mex\_id} inside the bisque container? There should be at least a `docker_run.log` and if it started the python process there should be a `PythonScript.log`. Can you also give me the outputs for both of these if they exist?
