Identify credit card shape using machine learning I have to approach this task: identify credit card from an image. I am attaching example image below:

I have to identify and localize the credit card from this image. The real challenge is that the card can be placed on any background and the color of the card can change based on the company it belongs to.
In order to solve this task I tried using the tensor flow object detection api. The downside of this api is that it fails to recognize cards which are not in its training data set.
My problem here is I am not concerned with the color of card or what information the card has. I am only concerned about finding the outline of card in an image and isolating the outline of card from rest of the image.
Is there a way using ML/CNN to do this. I tried OpenCV approaches to detect contours but even this approach fails when there is lot of text or other noise in the cards background.
I am only concerned about finding the outline of card in an image and isolating the outline of card from rest of the image.

This can be efficiently solved by semantic segmentation (aka dense prediction) - problem in which every pixel must be labeled with class.
In your case, you will have 2 classes: credit card and background. And you will need to have annotated dataset in such way: for every image, every pixel should have a class label. If you will be annotating it manually, I guess that credit cards (because of their simple shape) can be annotated easily.
Here is a good solution in Keras for semantic segmentation models. It offers a lot of different architectures and backbones and it will be straightforward to apply it to your problem.
There are also implementations in other frameworks on the web.