work_with_stagesepx icon indicating copy to clipboard operation
work_with_stagesepx copied to clipboard

可以动态的调整输出分组,把它分成我们想要的组吗?

Open liminghe-li opened this issue 4 years ago • 10 comments

我在生成训练集后,生成了0-8训练接,但是后面四个不是我们想要的,我们希望只保留0-4(4以后的部分都合并到4中) 我在手动修改dataset后,进行模型训练并执行classify_with_model.py 但是报告中仍然分成了0-8 改如何调整输出层的分组呢?我们希望能自动分成4组

liminghe-li avatar May 22 '20 09:05 liminghe-li

麻烦贴下代码看看哈

williamfzc avatar May 22 '20 09:05 williamfzc

from stagesepx.cutter import VideoCutter from stagesepx.classifier.keras import KerasClassifier from stagesepx.reporter import Reporter from stagesepx.video import VideoObject

video_path = "../videos/427-11280.mp4" video = VideoObject(video_path) video.load_frames()

--- cutter ---

cutter = VideoCutter() res = cutter.cut(video) stable, unstable = res.get_range(offset=3)

--- classifier ---

cl = KerasClassifier( # 在使用时需要保证数据集格式统一(与训练集) # 因为 train_model.py 用了 600x800,所以这里设定成一样的 target_size=(600, 800), ) model_file = "./model3.h5" cl.load_model(model_file)

classify_result = cl.classify(video, stable, keep_data=True) result_dict = classify_result.to_dict()

--- draw ---

r = Reporter() r.draw(classify_result)

liminghe-li avatar May 22 '20 09:05 liminghe-li

我直接用了demo的代码,只是换了下视频源

liminghe-li avatar May 22 '20 09:05 liminghe-li

代码看起来没什么问题,训练集分成什么样了?截个图看看

williamfzc avatar May 22 '20 10:05 williamfzc

image

liminghe-li avatar May 22 '20 10:05 liminghe-li

上面是原始训练集 这是手工调整后的训练集 image

liminghe-li avatar May 22 '20 10:05 liminghe-li

比较有可能是训练的时候:

  • 选错了训练集路径
  • 选错了模型路径

导致了模型还是旧的。你可以看看有没有上面两个问题

williamfzc avatar May 22 '20 10:05 williamfzc

比较有可能是训练的时候:

  • 选错了训练集路径
  • 选错了模型路径

导致了模型还是旧的。你可以看看有没有上面两个问题

都没有,这两个我确认都没有 但是我尝试了另外一个方法 我在下面这个方法里面传入threshold=0.8后,实现了分组变少,但是这样并不能满足的需求,我希望分组是由训练集分组决定的 stable, unstable = res.get_range(threshold=0.8,offset=3)

liminghe-li avatar May 22 '20 10:05 liminghe-li

联系我看看吧:https://github.com/williamfzc/stagesepx#%E8%81%94%E7%B3%BB%E6%88%91%E4%BB%AC

williamfzc avatar May 22 '20 10:05 williamfzc

联系我看看吧:https://github.com/williamfzc/stagesepx#%E8%81%94%E7%B3%BB%E6%88%91%E4%BB%AC

好的~我申请加一下您的QQ

liminghe-li avatar May 22 '20 10:05 liminghe-li