The 5G era brings the rapid development of the Internet of Things (IoT). New technologies, such as image recognition, have promoted the traditional agriculture to a new milestone. Through advanced research and development of image recognition, it can intelligently monitor the growth of crops and effectively reduce agricultural damages, while avoiding crops being stolen and reducing the manpower of farms. In this paper, we design and implement an image electronic fence based on the technology of image recognition and sensor fusion with 5G technology for smart farms. By applying cameras and beacon tags, our system can identify whether the incoming/leaving people are authorized or not at the entry and exit of farms. In addition, with the high speed and low latency of 5G technology, the video data of cameras can be transmitted in a flash and fused with the beacon detection. In this way, the incoming/leaving people can be identified efficiently so as to avoid the farms being damaged. Based on field trials, we validate that the identification accuracy of our system approaches 90% in average.