How to recognise a cube and label its feature points

Hello,

I found a challenging problem and had no clue about it.

Introduction

Here is the cube


As you can see, it has red graphics on the front and one side, what I want to do is to identify the four feature points of the red graphics on the front and the three feature points of the graphic on the side like this in a dark picture.(There is a special point B on the front that needs special marking)

My Problem

Now, I’ve used a rather foolhardy method to successfully recognise images, but it doesn’t work for all datasets, and here is my source code (Github Page) (datasets: /image/input/)

Can anyone provide me with better ideas and methods? I appreciate any help.