I have tried your code and it is working fine but I want to run the code on custom images , how it is possible ?