yolov5-face改写成四点模型

问题遇到的现象和发生背景

yolov5-face 改变成四点模型,将类别改成36时,报错。

用代码块功能插入代码,请勿粘贴截图
运行结果及报错内容

Traceback (most recent call last):
File "train.py", line 512, in
train(hyp, opt, device, tb_writer, wandb)
File "train.py", line 290, in train
loss, loss_items = compute_loss(pred, targets.to(device), model) # loss scaled by batch_size
File "/home/dqs/桌面/yoloface/utils/loss.py", line 119, in compute_loss
tcls, tbox, indices, anchors, tlandmarks, lmks_mask = build_targets(p, targets, model) # targets
File "/home/dqs/桌面/yoloface/utils/loss.py", line 250, in build_targets
indices.append((b, a, gj.clamp_(0, gain[3] - 1), gi.clamp_(0, gain[2] - 1))) # image, anchor, grid indices
RuntimeError: result type Float can't be cast to the desired output type long int
错误地方:
indices.append((b, a, gj.clamp_(0, gain[3] - 1), gi.clamp_(0, gain[2] - 1))) # image, anchor, grid indices

我的解答思路和尝试过的方法
我想要达到的结果

YOLOv5-face默认使用的是左眼、右眼、鼻子、左嘴角、右嘴角五个点来描述人脸轮廓的,如果改变为四点模型,需要修改模型的配置文件,指定输入和输出的维度。

如果将类别改成36时,报错,可能是由于模型的输出不支持36个类别,需要修改模型的配置文件,指定输出的类别数量。

建议先查看模型的配置文件,了解模型的输入和输出维度,然后根据实际需求进行修改。在修改配置文件时,需要注意保持配置文件的语法正确,避免出现报错。