WaqasSultani / AnomalyDetectionCVPR2018

502 stars 182 forks source link

TypeError: __init__() missing 1 required positional argument: 'units' when run Test_Anomaly_Detector_public.py #74

Open vovantuan1999a opened 4 years ago

vovantuan1999a commented 4 years ago

Traceback (most recent call last): File "Test_Anomaly_Detector_public.py", line 112, in model=load_model(model_path) File "Test_Anomaly_Detector_public.py", line 35, in load_model model = model_from_json(open(json_path).read()) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/_impl/keras/models.py", line 360, in model_from_json return layer_module.deserialize(config, custom_objects=custom_objects) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/_impl/keras/layers/serialization.py", line 63, in deserialize printable_module_name='layer') File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/_impl/keras/utils/generic_utils.py", line 163, in deserialize_keras_object list(custom_objects.items()))) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/_impl/keras/models.py", line 1237, in from_config layer = layer_module.deserialize(conf, custom_objects=custom_objects) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/_impl/keras/layers/serialization.py", line 63, in deserialize printable_module_name='layer') File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/_impl/keras/utils/generic_utils.py", line 165, in deserialize_keras_object return cls.from_config(config['config']) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/_impl/keras/engine/topology.py", line 475, in from_config return cls(**config) TypeError: init() missing 1 required positional argument: 'units' Hi. I'm study in university. I follow paper for academic purposes. While I run Test_Anomaly_Detector_public.py, I got this error. I hope the author can help me fix this error. Best regards

hello-ht commented 3 years ago

Hello, I want to ask you whether this problem is solved, I also encountered the same problem

hazemfahmyy commented 3 years ago

I solved the problem by changing the name "output_dims" to "units" in the json file

hello-ht commented 3 years ago

Thank you very much, you are right. The model must have the “units" parameter, I added the "units" to Json

vovantuan1999a commented 3 years ago

Thank you for your respone.

This is helpful for me.

Thank you and best regards.

Vào 20:38, Th 6, 23 thg 4, 2021 hello-ht @.***> đã viết:

Thank you very much, you are right. The model must have the unit parameter, I added the unit to Json

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/WaqasSultani/AnomalyDetectionCVPR2018/issues/74#issuecomment-825664426, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKJ5EASC45R7DQS53SCFNBDTKFZ3ZANCNFSM4M4WSZ5Q .

FatimaDua commented 3 years ago

I solved the problem by changing the name "output_dims" to "units" in the json file

It helped me, Thank you aalot