Esri / deep-learning-frameworks

Installation support for Deep Learning Frameworks for the ArcGIS System
433 stars 105 forks source link

Modify fcnn.predict to Accept Image NumPy Array Instead of Image Path #93

Open Abbsalehi opened 2 weeks ago

Abbsalehi commented 2 weeks ago

Description:

Dear contributors,

Thanks for your all efforts, currently, the fcnn.predict function in FasterRCNN accepts just an image path as input. This approach is limiting, especially in workflows where images are already loaded into memory as NumPy arrays for preprocessing or augmentation. Allowing fcnn.predict to accept a NumPy array directly would enhance flexibility and efficiency, avoiding the need for redundant disk I/O operations.

Proposed change:

Modify the fcnn.predict method to accept a NumPy array representing the image, in addition to the existing option of providing an image path. The method should be able to detect the input type and handle it accordingly. For instance:

If the input is a string, assume it’s a file path and load the image as currently done. If the input is a NumPy array, use the array directly for prediction.

image_array = np.array([...])  # Image loaded as a NumPy array

[bbx, _, score] = fcnn.predict(image_array,...)

I would highly appreciate it if you could modify this!

scw commented 2 weeks ago

@Abbsalehi Thanks for your suggestion! I've brought this to the attention to the team that works on these prediction function signatures.

Abbsalehi commented 2 weeks ago

@scw thanks for your reply! Looking forward to hearing from you!