执行pointpillars的模型转时报了一个关于protobuf的错误:

nvidia@nvidia-desktop:~/hive_pointpillars/second/pytorch$ python3 hive_convert.py 
/home/nvidia/.local/lib/python3.6/site-packages/skcuda/cublas.py:284: UserWarning: creating CUBLAS context to get version number
  warnings.warn('creating CUBLAS context to get version number')
Traceback (most recent call last):
  File "hive_convert.py", line 8, in <module>
    from hive_context import PointPillarsContext
  File "/home/nvidia/hive_pointpillars/second/pytorch/hive_context.py", line 8, in <module>
    from second.builder import target_assigner_builder,voxel_builder
  File "/home/nvidia/hive_pointpillars/second/builder/target_assigner_builder.py", line 4, in <module>
    from second.protos import target_pb2, anchors_pb2
  File "/home/nvidia/hive_pointpillars/second/protos/target_pb2.py", line 15, in <module>
    from second.protos import anchors_pb2 as second_dot_protos_dot_anchors__pb2
  File "/home/nvidia/hive_pointpillars/second/protos/anchors_pb2.py", line 22, in <module>
    serialized_pb=_b('\n\x1bsecond/protos/anchors.proto\x12\rsecond.protos\"\xa2\x01\n\x12\x41nchorGeneratorOld\x12\x12\n\nclass_name\x18\x01 \x01(\t\x12\x11\n\tbev_range\x18\x02 \x03(\x02\x12\x17\n\x0f\x61nchor_center_z\x18\x03 \x01(\x02\x12\x14\n\x0c\x61nchor_sizes\x18\x04 \x03(\x02\x12\x19\n\x11matched_threshold\x18\x05 \x01(\x02\x12\x1b\n\x13unmatched_threshold\x18\x06 \x01(\x02\"\xa7\x01\n\x15\x41nchorGeneratorStride\x12\x12\n\nclass_name\x18\x01 \x01(\t\x12\r\n\x05sizes\x18\x02 \x03(\x02\x12\x0f\n\x07strides\x18\x03 \x03(\x02\x12\x0f\n\x07offsets\x18\x04 \x03(\x02\x12\x11\n\trotations\x18\x05 \x03(\x02\x12\x19\n\x11matched_threshold\x18\x06 \x01(\x02\x12\x1b\n\x13unmatched_threshold\x18\x07 \x01(\x02\"\x9b\x01\n\x14\x41nchorGeneratorRange\x12\x12\n\nclass_name\x18\x01 \x01(\t\x12\r\n\x05sizes\x18\x02 \x03(\x02\x12\x15\n\ranchor_ranges\x18\x03 \x03(\x02\x12\x11\n\trotations\x18\x04 \x03(\x02\x12\x19\n\x11matched_threshold\x18\x05 \x01(\x02\x12\x1b\n\x13unmatched_threshold\x18\x06 \x01(\x02\"\x82\x02\n\x19\x41nchorGeneratorCollection\x12G\n\x17\x61nchor_generator_stride\x18\x01 \x01(\x0b\x32$.second.protos.AnchorGeneratorStrideH\x00\x12\x45\n\x16\x61nchor_generator_range\x18\x02 \x01(\x0b\x32#.second.protos.AnchorGeneratorRangeH\x00\x12\x41\n\x14\x61nchor_generator_old\x18\x03 \x01(\x0b\x32!.second.protos.AnchorGeneratorOldH\x00\x42\x12\n\x10\x61nchor_generator\"\xa8\x01\n\x16\x41nchorGenerator_depara\x12\x12\n\nclass_name\x18\x01 \x01(\t\x12\r\n\x05sizes\x18\x02 \x03(\x02\x12\x0f\n\x07strides\x18\x03 \x03(\x02\x12\x0f\n\x07offsets\x18\x04 \x03(\x02\x12\x11\n\trotations\x18\x05 \x03(\x02\x12\x19\n\x11matched_threshold\x18\x06 \x01(\x02\x12\x1b\n\x13unmatched_threshold\x18\x07 \x01(\x02\"z\n\x11\x41nchorGeneratorV1\x12\x17\n\x0f\x61nchor_center_z\x18\x01 \x01(\x02\x12\x14\n\x0c\x61nchor_sizes\x18\x02 \x03(\x02\x12\x19\n\x11matched_threshold\x18\x03 \x01(\x02\x12\x1b\n\x13unmatched_threshold\x18\x04 \x01(\x02\x62\x06proto3')
TypeError: __new__() got an unexpected keyword argument 'serialized_options'

怀疑是protobuf版本过低的问题,检查一下版本。

nvidia@nvidia-desktop:~/hive_pointpillars/second/pytorch$ pip3 list|grep -i protobuf
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
protobuf (3.0.0)

当前版本为3.0.0,尝试升级到最新版本。
nvidia@nvidia-desktop:~/hive_pointpillars/second/pytorch$ pip3 install -U protobuf
Collecting protobuf
  Downloading https://files.pythonhosted.org/packages/d5/e0/20ba06eb42155cdb4c741e5caf9946e4569e26d71165abaecada18c58603/protobuf-3.17.3-py2.py3-none-any.whl (173kB)
    100% |████████████████████████████████| 174kB 833kB/s 
Collecting six>=1.9 (from protobuf)
  Using cached https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl
Installing collected packages: six, protobuf
Successfully installed protobuf-3.17.3 six-1.16.0

完美解决!!
 

更多推荐