我在python中尝试yolo模型. 要处理数据和注释,我要分批处理数据.
I trying yolo model in python. To process the data and annotation I'm taking the data in batches.
batchsize = 50 #boxList= [] #boxArr = np.empty(shape = (0,26,5)) for i in range(0, len(box_list), batchsize): boxList = box_list[i:i+batchsize] imagesList = image_list[i:i+batchsize] #to convert the annotation from VOC format convertedBox = np.array([np.array(get_boxes_for_id(box_l)) for box_l in boxList]) #pre-process on image and annotaion image_data, boxes = process_input_data(imagesList,max_boxes,convertedBox) boxes = np.array(list(itertools.chain.from_iterable(boxes))) detectors_mask, matching_true_boxes = get_detector_mask(boxes, anchors)此后,我想将我的数据传递给模型进行训练. 当我追加列表时,由于数组大小,它给出了内存错误. 当我追加数组时由于形状而导致尺寸错误.
after this, I want to pass my data to the model to train. when I append the list it gives memory error because of array size. and when i append array gives dimensionality error because of shape.
我该如何训练数据以及应该使用model.fit()或model.train_on_batch()
how can i train the data and what shoud i use model.fit() or model.train_on_batch()
推荐答案如果您正在使用Keras通过一堆图像训练模型,则可以使用Train生成器和验证生成器,只需将图像放入那里有各自的班级文件夹.看一个示例代码.也请看一下此链接,也许它可以帮助您
If you are using Keras to Train your model with a bunch of Images you can use Train generator and validation generator, all you have to do is put your images in there respective class folders. look at a sample code . also take a look at this link maybe it may help you
更多推荐
如何批量训练模型
发布评论