sunzheng

Results 52 comments of sunzheng

https://github.com/yyccR/yolov5_in_tf2_keras/blob/3e6645cbf94d2a1e11c33663e80113daa4590321/train.py#L72-L74 我后面加了个yolov5.save(log_dir + '/yolov5-tf', save_format='tf'),想保存成savedmodel部署到tf seving上,但是报错哎 ``` File "H:/face_landmark/bd-face-detector/face_details_detector/yolov5_in_tf2_keras-master/train.py", line 107, in main yolov5.save(log_dir + '/yolov5-tf', save_format='tf') File "D:\ProgramData\Anaconda3\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler raise e.with_traceback(filtered_tb) from None File "D:\ProgramData\Anaconda3\lib\json\encoder.py", line...

在这里保存是不是batch size就被固定住了

2.7.0,换成2.3.0好像好一点

好的我试一下~!

https://github.com/yyccR/yolov5_in_tf2_keras/blob/269385d53dcffc416064852462327db026207678/train.py#L100-L111 能在这个位置中间保存一下,然后后面做inference吗 ``` ''' 生成saved model ''' inputs = tf.keras.Input(shape=(640, 640, 3)) yolo_preds = yolov5(inputs, training=True) yolo_head_output = yolo.yolo_head(yolo_preds, is_training=False) nms_output = yolo.nms(yolo_head_output, iou_thres=0.3) model = tf.keras.Model(inputs, nms_output ) model.save(r'./whole_model_20220309',...

嗯我知道,如果这么inference的话必须传batch_size张图片,所以想换个形式保存看看 报错如下,我的batch_size为16,172800 * 16 = 2764800 `Traceback (most recent call last): File "H:/face_landmark/bd-face-detector/face_details_detector/yolov5_in_tf2_keras-master/inference.py", line 188, in yolo_preds = yolo.yolov5.predict(input_data) File "D:\ProgramData\Anaconda3\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler raise e.with_traceback(filtered_tb) from None File...

哈哈哈哈好的,input_data = np.tile(np.expand_dims(input_data, axis=0), (16, 1, 1, 1)),我先这么弄看看,还是有点报错,辛苦辛苦

``` yolo = Yolo( image_shape=image_shape, batch_size=batch_size, num_class=num_class, is_training=False, anchors=anchors, anchor_masks=anchor_masks, strides=[8, 16, 32], net_type='5s', model_path=r'C:\Users\Administrator\Desktop\yolov5-20220309-5s-tf-20.h5' ) # image shape(batch, h, w, 3) yolo.yolov5.summary() ``` 我summary了一下为啥出来的结果都堆在一起了,类似这样 ``` tf.reshape_3 (TFOpLambda) (16, 19200,...

哦哦哦,那就是刚才inference的时候`yolo_head_output = yolo.yolo_head(yolo_preds, is_training=False)`这个不需要,只需要 ``` yolo = Yolo( image_shape=image_shape, batch_size=batch_size, num_class=num_class, is_training=False, anchors=anchors, anchor_masks=anchor_masks, strides=[8, 16, 32], net_type='5s', model_path=r'C:\Users\Administrator\Desktop\yolov5-20220309-5s-tf-20.h5' ) # image shape(batch, h, w, 3) yolo.yolov5.summary() yolo_preds = yolo.yolov5.predict(input_data)...

对的,我也很奇怪,明明里面封装好了,为啥我调不到