如何批量训练模型

编程入门 行业动态 更新时间:2024-10-24 00:25:57
本文介绍了如何批量训练模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在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

更多推荐

如何批量训练模型

本文发布于:2023-11-10 09:46:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1575043.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:批量   模型

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!