The smart farming solutions are mainly based on the application of convolutional neural networks for object detection tasks. The number of open datasets is restricted in the agricultural domain. Therefore, it is required to find the answer to the question: how big a dataset must be collected to train a convolutional neural network for object detection tasks? To solve this task, the YOLOv8 framework was selected for the experiment. Three datasets were prepared: MinneApples, PFruitlets640 and mosaic dataset using both previously named datasets. 100 images were selected for testing. Other images were used to create training datasets, which had the size from 100 until 1000 images with step 100 images. Training was repeated 10 times with each size of dataset. The experiment showed that the increase of dataset from 100 to 500 images provides an accuracy growth up to 15.48% mAP@0.5, but from 600 to 1000 images - only 2.98% mAP@0.5. This study experimentally proves that the dataset size equal to 500 images is the most efficient. Meanwhile, the experiment with the mosaic dataset shows constant accuracy improvement. Therefore, it is more advisable to collect different classes with 500 images than one large dataset. This study will be interesting not only for smart farming experts as well as for all machine learning experts.