QiaoranC / tf_ResNeSt_RegNet_model

tensorflow 2.x version of ResNeSt,RegNet,DETR
129 stars 31 forks source link

An error occurred while saving the model #10

Closed asker-github closed 4 years ago

asker-github commented 4 years ago

Hello, I had a very strange problem, as if no one else had.I made two changes to make the code work. model_name = 'ResNest50'

  1. inter_channels = max(in_channels * radix // reduction_factor, 32)

    inter_channels = int(max(in_channels * radix // reduction_factor, 32))

    https://github.com/QiaoranC/tf_ResNeSt_RegNet_model/blob/master/models/ResNest.py#L200

  2. if model_name in resnest3d_parameters.keys():

    elif model_name in resnest3d_parameters.keys(): https://github.com/QiaoranC/tf_ResNeSt_RegNet_model/blob/master/models/model_factory.py#L96

keras: 2.2.5 tf: 1.14.0 code: model.save('xxx.h5')

Traceback (most recent call last): File "/home/zhu/zhu_tf/tf_ResNeSt_RegNet_model-master/main.py", line 39, in model.save('xxx.h5') File "/home/zhu/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/network.py", line 1211, in save saving.save_model(self, filepath, overwrite, include_optimizer, save_format) File "/home/zhu/.local/lib/python3.6/site-packages/tensorflow/python/keras/saving/save.py", line 113, in save_model model, filepath, overwrite, include_optimizer) File "/home/zhu/.local/lib/python3.6/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 101, in save_model_to_hdf5 default=serialization.get_json_type).encode('utf8') File "/usr/lib/python3.6/json/init.py", line 238, in dumps kw).encode(obj) File "/usr/lib/python3.6/json/encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "/usr/lib/python3.6/json/encoder.py", line 257, in iterencode return _iterencode(o, 0) File "/home/zhu/.local/lib/python3.6/site-packages/tensorflow/python/util/serialization.py", line 70, in get_json_type raise TypeError('Not JSON Serializable:', obj) TypeError*: ('Not JSON Serializable:', b'\n\x05split\x12\x06SplitV\x1a\x11activation_3/Relu\x1a\x05Const\x1a\x0fsplit/split_dim\x07\n\x01T\x12\x020\x01\x0f\n\tnum_split\x12\x02\x18\x02\n\n\x04Tlen\x12\x020\x03')

asker-github commented 4 years ago

After upgrading TF = = 2.1.0, there is no such problem, but the training effect is not ideal. Because the official version is too complex to run successfully, the performance of this version cannot be evaluated. I wonder if anyone can compare the performance of this version with the official version.