Open NasaKHw opened 9 months ago
u should write it like this and save it to outputfile to work but i dont know why is it considering a bird as sexy!!!
from nsfw_detector import predict
model = predict.load_model('models/nsfw.299x299.h5')
results = predict.classify(model, 'output_frames299', 299)
output_file = 'output_results.txt'
with open(output_file, 'w') as f: for image_path, result in results.items(): f.write(f"Image: {image_path}\n") for category, probability in result.items(): f.write(f"{category}: {probability}\n") f.write("\n")
print(f"Output written to {output_file}")
Hello
im sure that my images are 299 299 i also tried :
from nsfw_detector import predict model = predict.load_model('models/nsfw.299x299.h5') predict.classify(model, 'test/frames/', 299)
or
from nsfw_detector import predict model = predict.load_model('models/nsfw.299x299.h5')
Predict single image
predict.classify(model, 'test/frames/output_0045.jpg', 299)
output : :38] TF-TRT Warning: Could not find TensorRT test/frames/output_0045.jpg size: (299, 299) 1/1 [==============================] - 2s 2s/step [root@server-194-5-205-78 nsfw_model]#
but it did not print the result and only printed images name and , 299 thats all any trick to solve it ?