The structured social hierarchies and individual social bonds within dairy cows’ groups significantly influence their welfare and productivity. Traditional monitoring methods are labour-intensive and often lacking insights into precise spatial positioning or the nature of behaviour. Here, a computer vision system was proposed, employing YOLOv8, for automated identification and tracking of dairy cows in barns equipped with Automated Milking Systems. The study pioneers the analysis of social interactions among 240 dairy cows using computer vision. Through comprehensive dataset preparation and model training, robust performance in cow detection and tracking was achieved. Evaluation metrics demonstrate the model’s effectiveness in real-world settings, with high precision and recall values. The construction of temporal social networks was enabled, revealing insights into cow interactions. The results indicate the model’s suitability for practical use, paving the way for future real-time analyses of cow social networks and promising advancements in dairy farming management. © 2024 11th European Conference on Precision Livestock Farming. All rights reserved.