notAI-tech / NudeNet

Lightweight nudity detection
https://nudenet.notai.tech/
GNU Affero General Public License v3.0
1.76k stars 342 forks source link

New detector only inputs path, can't use with cv images. #143

Closed rbtreee closed 5 months ago

rbtreee commented 5 months ago

I noticed that the new detector can't handle any other input other than image paths. I think it would be beneficial be be able to use it with an already loaded image. This issue happens due to the function _read_image. By just changing 2 lines of code you would be able to use ndarray's as input.

def _read_image(image_path, target_size=320):
    if(type(image_path) == str):
        img = cv2.imread(image_path)
    else:
        #assuming that image_path is an np.ndarray
        img = image_path
bedapudi6788 commented 5 months ago

@rbtreee Can you submit a MR? thanks

enkeejunior1 commented 5 months ago

I opened PR for this issue. https://github.com/notAI-tech/NudeNet/pull/144

bedapudi6788 commented 5 months ago

merged, thanks. will push the new version