Posts
Q&A
train_isbi_2012.py ์คํ์ค epoch์ฒซ๋ฒ์งธ ๋๋๊ณ ๋ชจ๋ธ์ ์ ์ฅํ ๋ ๋จ๋ ์๋ฌ์ ๋๋ค.
์๊พธ ์ง๋ฌธ๋๋ ค ์ฃ์กํฉ๋๋ค. ๋ง์ํด์ฃผ์ ๋๋ก h5 ์ ์ฅ๋ฐฉ์์์ ๋ฐ๋์๋ค ๋ณด๋๊น, evaluate์์ ์ ์ฅ๋ ๋ชจ๋ธ์ ๋ค์ ๋ถ๋ฌ์ค๋ ๋ถ๋ถ๋ ๋ฐ๊ฟ์ ์งํํด์ผํ ๊ฒ๊ฐ์ ๊ณต์ํํ์ด์ง ์ฐธ๊ณ ํ์ฌ flags.DEFINE_string('checkpoint_path', default='/unet_model', help='path to a directory to restore checkpoint file') ์์๊ฐ์ด ์ ์ฅํ ๋์ ๋ง์ฐฌ๊ฐ์ง์ ๊ฒฝ๋ก๋ก ๋ฐ๊พธ์ด ์ฃผ์๊ตฌ ๋ก๋ํ๋ ๋ถ๋ถ๋ ๊ณต์ํํผ์ ์ค๋ช ์๋ฐ๋ผ ์๋ ์ฝ๋ ์ฃผ์์ฒ๋ฆฌํ๊ณ # unet_model.load_weights(FLAGS.checkpoint_path) unet_model.load_model(FLAGS.checkpoint_path) ์์๊ฐ์ด ๋ฐ๊พธ์๋๋ฐ, Traceback (most recent call last): File "evaluate_isbi_2012.py", line 90, in app.run(main) File "/media/jjaysohn/Jangjay/Pydicom_read/U-Netpractice/U-net/lib/python3.8/site-packages/absl/app.py", line 312, in run _run_main(main, args) File "/media/jjaysohn/Jangjay/Pydicom_read/U-Netpractice/U-net/lib/python3.8/site-packages/absl/app.py", line 258, in _run_main sys.exit(main(argv)) File "evaluate_isbi_2012.py", line 67, in main unet_model.load_model(FLAGS.checkpoint_path) AttributeError: 'UNET_ISBI_2012' object has no attribute 'load_model' load_model์ด๋ผ๋ ์์ฑ์ด ์๋ค๊ณ ๋์ค๋๋ผ๊ตฌ์(๊ณต์ํํผ๋ ์๋ ๋งํฌ๋ฅผ ์ฐธ์กฐํ์ต๋๋ค.) https://www.tensorflow.org/tutorials/keras/save_and_load?hl=ko UNET_ISBI_2012๊ฐ ๋ชจ๋ธ ์์ฑ์ ๋ฐ์ ํจ์์ฌ์ ๊ทธ๋๋ก ์ฌ์ฉํ๋ฉด ๋ ์ค์์๋๋ฐ, ์์๊ฐ์ ์ค๋ฅ๊ฐ๋จ๋ฉด ์ด๋ป๊ฒ ํด๊ฒฐํด์ผํ๋์ง ์ฌ์ญ์ต๋๋ค.
- 0
- 3
- 1.6K
Q&A
train_isbi_2012.py ์คํ์ค epoch์ฒซ๋ฒ์งธ ๋๋๊ณ ๋ชจ๋ธ์ ์ ์ฅํ ๋ ๋จ๋ ์๋ฌ์ ๋๋ค.
train_isbi_2012.py:180: UserWarning: `Model.fit_generator` is deprecated and will be removed in a future version. Please use `Model.fit`, which supports generators. unet_model.fit_generator(train_generator, Epoch 1/5 2022-03-28 15:40:59.839414: W tensorflow/core/framework/cpu_allocator_impl.cc:82] Allocation of 1207959552 exceeds 10% of free system memory. 2022-03-28 15:40:59.851804: W tensorflow/core/framework/cpu_allocator_impl.cc:82] Allocation of 1207959552 exceeds 10% of free system memory. 1/2000 [..............................] - ETA: 8:28:49 - loss: 0.5343 - accuracy: 0.75872022-03-28 15:41:14.463919: W tensorflow/core/framework/cpu_allocator_impl.cc:82] Allocation of 1207959552 exceeds 10% of free system memory. 2022-03-28 15:41:14.464060: W tensorflow/core/framework/cpu_allocator_impl.cc:82] Allocation of 1207959552 exceeds 10% of free system memory. 2/2000 [..............................] - ETA: 8:31:23 - loss: 0.6406 - accuracy: 0.77262022-03-28 15:41:29.882777: W tensorflow/core/framework/cpu_allocator_impl.cc:82] Allocation of 1207959552 exceeds 10% of free system memory. 2000/2000 [==============================] - ETA: 0s - loss: 0.1751 - accuracy: 0.9234 Epoch 1: loss improved from inf to 0.17507, saving model to unet_model.h5 Traceback (most recent call last): File "train_isbi_2012.py", line 186, in app.run(main) File "/media/jjaysohn/Jangjay/Pydicom_read/U-Netpractice/U-net/lib/python3.8/site-packages/absl/app.py", line 312, in run _run_main(main, args) File "/media/jjaysohn/Jangjay/Pydicom_read/U-Netpractice/U-net/lib/python3.8/site-packages/absl/app.py", line 258, in _run_main sys.exit(main(argv)) File "train_isbi_2012.py", line 180, in main unet_model.fit_generator(train_generator, File "/media/jjaysohn/Jangjay/Pydicom_read/U-Netpractice/U-net/lib/python3.8/site-packages/keras/engine/training.py", line 2209, in fit_generator return self.fit( File "/media/jjaysohn/Jangjay/Pydicom_read/U-Netpractice/U-net/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 67, in error_handler raise e.with_traceback(filtered_tb) from None File "/media/jjaysohn/Jangjay/Pydicom_read/U-Netpractice/U-net/lib/python3.8/site-packages/keras/saving/save.py", line 140, in save_model raise NotImplementedError( NotImplementedError: Saving the model to HDF5 format requires the model to be a Functional model or a Sequential model. It does not work for subclassed models, because such models are defined via the body of a Python method, which isn't safely serializable. Consider saving to the Tensorflow SavedModel format (by setting save_format="tf") or using `save_weights`. 2022-03-28 23:02:14.273774: W tensorflow/core/kernels/data/generator_dataset_op.cc:107] Error occurred when finalizing GeneratorDataset iterator: FAILED_PRECONDITION: Python interpreter state is not initialized. The process may be terminated. [[{{node PyFunc}}]] ๋ง์์ฃผ์ ๋๋ก ์คํํด๋ณด์๋๋ฐ, ๋ง์ฐฌ๊ฐ์ง ์ค๋ฅ๊ฐ ๋ด์ด์ ใ . ์ข๋ ์ฐพ์๋ณผํ ๋ฐ, ํน์ ์ถ๊ฐ ํด๊ฒฐ๋ฒ ์์๋๋ฒ ์์ผ๋ฉด ์๋ ค์ฃผ์๋ฉด ๊ฐ์ฌํ๊ฒ ์ต๋๋ค. ๊ฐ์ฌํฉ๋๋ค.
- 0
- 3
- 1.6K