In recent years, deep neural networks have continuously achieved breakthroughs in the classification task. However, they will mistakenly give a wrong known class prediction when faced with unknown samples in the testing phase. The open set recognition is a possible way to solve the problem, which requires the model to not only classify the known classes but also distinguish the unknown samples accurately. Most of the existing methods are designed heuristically on the basis of certain assumptions. Despite keeping the performance increasing, they have not analyzed the key factors that affect the task. In this paper, we analyze the commonalities of existing methods by designing a new decision variable experiment and find that the ability of the model to learn representations of known classes is an important factor. Then an open set recognition method is proposed based on the representation learning ability enhancement of the model. Firstly, due to the powerful representation learning capabilities demonstrated by the contrastive learning and the label information contained in the open set recognition task, supervised contrastive learning is introduced to improve the modeling ability of the model for known classes. Secondly, considering that the inter-class correlation is the representation learning at the class level, and the hierarchical structure relationship among the classes is often presented, a loss function of the multi-granularity inter-class correlation is designed. In the way of building the hierarchical structure in the label semantic space and measuring the multi-granularity inter-class correlation, the loss function of multi-granularity inter-class correlation constrains the model to learn the correlation among different known classes to further improve the representation learning ability of the model. Finally, experimental results on multiple standard datasets verify the effectiveness of the proposed method in open set recognition.