I'm using g2.2 xlarge instance of amazon.
I'm having this function that takes 3 minutes to run on my laptop which is so slow.
         However, when running it on EC2 it takes the same time , sometimes even more.
Seeing the statistics , I noticed EC2 uses at its best 25% of CPU.
I paralleled my code, It's better but I get the same execution time between my laptop and EC2.
for my function:
I have an image as input,I run my function 2 times(image with and without image processing) that I managed to run them in parallel.  I then extract 8 text fields from that image using 2 machine learning algorithms(faster-rcnn(field detection)+clstm(text reading) and then the text is displayed on my computer.
Any idea how to improve performance (processing time) in EC2?
I think you need to profile your code locally and ensure it really is CPU bound. Could it be that time is spent on the network or accessing disk (e.g. reading the image to start with). 
If it is CPU bound then explore how to exploit all the cores available (and 25% sounds suspicious - is it maxing out one core?). Python can be hard to parallelise due to the (in)famous GIL. However, only worry about this when you can prove it's a problem, profile first!
Why amazon EC2 is as slow as my machine when running python code?