mdietrichstein / tensorflow-open_nsfw

Tensorflow Implementation of Yahoo's Open NSFW Model
Other
430 stars 136 forks source link

Check NSFW in video files #17

Open xcbtrader opened 5 years ago

xcbtrader commented 5 years ago

Hello. I've used your libraries to detect NSFW content in videos. It works correctly, but the problem is that I can't open the video frame and check it directly, as it tells me they are not compatible format. I need to open a frame, save it to disk in jpeg format, then open it and check. Is there any way to load the frame and check it directly?

I use OPENCV libraries to open the video file.

I then put a piece of the code


while(True): 

    # reading from frame 
    ret,frame = cam.read() 

    if ret:
        if currentframe % salto_frames == 0:
            frames_analizados += 1
            cv2.imwrite('temp.jpg', frame)  
            image = fn_load_image('temp.jpg')

            predictions = \
                sess.run(model.predictions,
                        feed_dict={model.input: image})

            nsf = predictions[0][0]
            nsfw = predictions[0][1]

I think it's possible to make

ret, frame = cam.read() image = frame

Any idea?? Thank you for this great library.