主要问题:
我应该对回购的源代码做什么改变,以成功地将我的YOLOv4暗网重量(带有自定义锚)转换成Tensorflow格式?
背景:
我使用这个回购将我的YOLOv4暗网权重转换为Tensorflow格式。
我使用YOLOv4自定义锚(9个锚)对自定义数据集进行了培训,但每个yolo层使用的锚数分别为4、3、2。默认情况下,YOLOv4使用每个yolo层3个锚点。
主要问题:
我使用的repo编码方式只考虑了默认锚点,其中有每个[yolo]层3个锚。
我试图做什么来解决主要问题:
python save_model.py --weights data/yolov4-512.weights --output ./checkpoints/yolov4-512 --input_size 512 --model yolov4
python detect.py --weights checkpoints/yolov4-512 --size 512 --model yolov4 --image data/pear.jpg
测试了生成的tf模型。进程失败了,错误可以在下面看到。我见过这里可能出现的问题,但我不知道如何解决它们。2021-03-19 15:05:03.694379: W tensorflow/core/common_runtime/bfc_allocator.cc:312] Garbage collection: deallocate free memory regions (i.e., allocations) so that we can re-allocate a larger region to avoid OOM due to memory fragmentation. If you see this message frequently, you are running near the threshold of the available device memory and re-allocation may incur great performance overhead. You may try smaller batch sizes to observe the performance impact. Set TF_ENABLE_GPU_GARBAGE_COLLECTION=false if you'd like to disable this feature.
Traceback (most recent call last):
File "detect.py", line 90, in <module>
app.run(main)
File "C:\Python37\lib\site-packages\absl\app.py", line 303, in run
_run_main(main, args)
File "C:\Python37\lib\site-packages\absl\app.py", line 251, in _run_main
sys.exit(main(argv))
File "detect.py", line 66, in main
pred_bbox = infer(batch_data)
File "C:\Python37\lib\site-packages\tensorflow\python\eager\function.py", line 1655, in __call__
return self._call_impl(args, kwargs)
File "C:\Python37\lib\site-packages\tensorflow\python\eager\function.py", line 1673, in _call_impl
return self._call_with_flat_signature(args, kwargs, cancellation_manager)
File "C:\Python37\lib\site-packages\tensorflow\python\eager\function.py", line 1722, in _call_with_flat_signature
return self._call_flat(args, self.captured_inputs, cancellation_manager)
File "C:\Python37\lib\site-packages\tensorflow\python\saved_model\load.py", line 106, in _call_flat
cancellation_manager)
File "C:\Python37\lib\site-packages\tensorflow\python\eager\function.py", line 1924, in _call_flat
ctx, args, cancellation_manager=cancellation_manager))
File "C:\Python37\lib\site-packages\tensorflow\python\eager\function.py", line 550, in call
ctx=ctx)
File "C:\Python37\lib\site-packages\tensorflow\python\eager\execute.py", line 60, in quick_execute
inputs, attrs, num_outputs)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to reshape is a tensor with 98304 values, but the requested shape has 73728
[[{{node StatefulPartitionedCall/functional_1/tf_op_layer_Reshape/Reshape}}]] [Op:__inference_signature_wrapper_5589]
Function call stack:
signature_wrapper
发布于 2021-03-21 19:23:08
我向您的一个先前的问题发布了关于YoloV4 (CSP)转换的答复。你试过看这是否管用了吗?
如果成功,您可以尝试在笔记本中的convert.py
命令中使用您自己的配置文件和权重,并查看它是否有效。
https://stackoverflow.com/questions/66703796
复制相似问题