taki0112 / UGATIT

Official Tensorflow implementation of U-GAT-IT: Unsupervised Generative Attentional Networks with Adaptive Layer-Instance Normalization for Image-to-Image Translation (ICLR 2020)
MIT License
6.17k stars 1.05k forks source link

selfie2anime checkpoint: 204 epoch #92

Open houseofai opened 4 years ago

houseofai commented 4 years ago

I just wanted to share a checkpoint that I have trained on the self2anime datasets up to 204 epochs.

Link on my forked README: https://github.com/OdysseeT/UGATIT

beyonehan commented 3 years ago

I download it ,but it shows fail to load checkpoint ,can you tell me the reason 截屏2020-07-24 下午3 58 15 截屏2020-07-24 下午3 58 27

houseofai commented 3 years ago

You need to unzip the checkpoints.zip file to the checkpoint folder. It should look like this: Screenshot from 2020-07-25 23-23-37

And get the latest version of my code, I added a fix. Tested and it works: Screenshot from 2020-07-25 23-24-46

beyonehan commented 3 years ago

thanks for you reply,but it still has the same error. I tried many times ,but I can find it out 截屏2020-07-28 上午11 36 34 截屏2020-07-28 上午11 34 39

houseofai commented 3 years ago

What version of Tensorflow do you have? It requires 1.15

Can you run this command: cat UGATIT.py | grep UGATIT.model-2044000 and provide the result

beyonehan commented 3 years ago

What version of Tensorflow do you have? It requires 1.15

Can you run this command: cat UGATIT.py | grep UGATIT.model-2044000 and provide the result

'1.15.0' vison
and run cat UGATIT.py | grep UGATIT.model-2044000` nothing happened 截屏2020-08-03 下午5 45 51 I really get confused about it

houseofai commented 3 years ago

On line 603 of UGATIT.py, I added a fix to load the checkpoint. If you don't have any output with the cat UGATIT.py | grep UGATIT.model-2044000 it means that you didn't pull the latest changes from my repository.

beyonehan commented 3 years ago

thank you very much .finally ,I got it. But when I test it with other head portrait, it seems not well.Could you tell how to get the effect like baiduAI https://ai.baidu.com/tech/imageprocess/selfie_anime

wwzh2015 commented 3 years ago

thank you very much .finally ,I got it. But when I test it with other head portrait, it seems not well.Could you tell how to get the effect like baiduAI https://ai.baidu.com/tech/imageprocess/selfie_anime

Baidu effect is very surpriseing!

ZengHorace commented 3 years ago

I can’t download the model completely, and it breaks every time I download it halfway, Can you provide other download methods?

wwzh2015 commented 3 years ago

I can’t download the model completely, and it breaks every time I download it halfway, Can you provide other download methods?

me too!

luoww1992 commented 3 years ago

我只想分享一个检查点,该检查点是我在多达204个纪元的self2anime数据集上训练的。

我分叉的自述文件上的链接:https : [//github.com/OdysseeT/UGATIT](https://github.com/OdysseeT/UGATIT

i have done all jobs before running, when i run it as you say with default setting , it show error:

[*] Reading checkpoints... INFO:tensorflow:Restoring parameters from checkpoint/UGATIT_selfie2anime_lsgan_4resblock_6dis_1_1_10_10_1000_sn_smoothing/UGATIT.model-2044000

OutOfRangeError Traceback (most recent call last) /media/M_fMVMGMfM!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/client/session.py in _do_call(self, fn, args) 1364 try: -> 1365 return fn(args) 1366 except errors.OpError as e:

/media/M_fMVMGMfM!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/client/session.py in _run_fn(feed_dict, fetch_list, target_list, options, run_metadata) 1349 return self._call_tf_sessionrun(options, feed_dict, fetch_list, -> 1350 target_list, run_metadata) 1351

/media/M_fMVMGMfM!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/client/session.py in _call_tf_sessionrun(self, options, feed_dict, fetch_list, target_list, run_metadata) 1442 fetch_list, target_list, -> 1443 run_metadata) 1444

OutOfRangeError: 2 root error(s) found. (0) Out of range: Read less bytes than requested [[{{node save/RestoreV2}}]] (1) Out of range: Read less bytes than requested [[{{node save/RestoreV2}}]] [[save/RestoreV2/_301]] 0 successful operations. 0 derived errors ignored.

During handling of the above exception, another exception occurred:

OutOfRangeError Traceback (most recent call last)

in 8 picture = "./data/woman.jpg" 9 ---> 10 img = gan.infer(picture) 11 12 original = Image(filename=picture) /media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/UGATIT/UGATIT.py in infer(self, img_path) 675 676 self.saver = tf.train.Saver() --> 677 could_load, checkpoint_counter = self.load(self.checkpoint_dir) 678 self.result_dir = os.path.join(self.result_dir, self.model_dir) 679 check_folder(self.result_dir) /media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/UGATIT/UGATIT.py in load(self, checkpoint_dir) 610 #print(111, os.path.join(checkpoint_dir, ckpt_name)) 611 #ckpt_name = os.path.basename(ckpt.model_checkpoint_path) --> 612 self.saver.restore(self.sess, os.path.join(checkpoint_dir, ckpt_name)) 613 counter = int(ckpt_name.split('-')[-1]) 614 print(" [*] Success to read {}".format(ckpt_name)) /media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/training/saver.py in restore(self, sess, save_path) 1288 else: 1289 sess.run(self.saver_def.restore_op_name, -> 1290 {self.saver_def.filename_tensor_name: save_path}) 1291 except errors.NotFoundError as err: 1292 # There are three common conditions that might cause this error: /media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/client/session.py in run(self, fetches, feed_dict, options, run_metadata) 954 try: 955 result = self._run(None, fetches, feed_dict, options_ptr, --> 956 run_metadata_ptr) 957 if run_metadata: 958 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr) /media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/client/session.py in _run(self, handle, fetches, feed_dict, options, run_metadata) 1178 if final_fetches or final_targets or (handle and feed_dict_tensor): 1179 results = self._do_run(handle, final_targets, final_fetches, -> 1180 feed_dict_tensor, options, run_metadata) 1181 else: 1182 results = [] /media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/client/session.py in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata) 1357 if handle is None: 1358 return self._do_call(_run_fn, feeds, fetches, targets, options, -> 1359 run_metadata) 1360 else: 1361 return self._do_call(_prun_fn, handle, feeds, fetches) /media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/client/session.py in _do_call(self, fn, *args) 1382 '\nsession_config.graph_options.rewrite_options.' 1383 'disable_meta_optimizer = True') -> 1384 raise type(e)(node_def, op, message) 1385 1386 def _extend_graph(self): OutOfRangeError: 2 root error(s) found. (0) Out of range: Read less bytes than requested [[node save/RestoreV2 (defined at /media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:1748) ]] (1) Out of range: Read less bytes than requested [[node save/RestoreV2 (defined at /media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:1748) ]] [[save/RestoreV2/_301]] 0 successful operations. 0 derived errors ignored. Original stack trace for 'save/RestoreV2': File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/ipykernel_launcher.py", line 16, in app.launch_new_instance() File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/traitlets/config/application.py", line 664, in launch_instance app.start() File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 597, in start self.io_loop.start() File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tornado/platform/asyncio.py", line 149, in start self.asyncio_loop.run_forever() File "/usr/lib/python3.6/asyncio/base_events.py", line 438, in run_forever self._run_once() File "/usr/lib/python3.6/asyncio/base_events.py", line 1451, in _run_once handle._run() File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run self._callback(*self._args) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tornado/ioloop.py", line 690, in lambda f: self._run_callback(functools.partial(callback, future)) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tornado/ioloop.py", line 743, in _run_callback ret = callback() File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tornado/gen.py", line 787, in inner self.run() File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tornado/gen.py", line 748, in run yielded = self.gen.send(value) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 365, in process_one yield gen.maybe_future(dispatch(*args)) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tornado/gen.py", line 209, in wrapper yielded = next(result) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 268, in dispatch_shell yield gen.maybe_future(handler(stream, idents, msg)) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tornado/gen.py", line 209, in wrapper yielded = next(result) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 545, in execute_request user_expressions, allow_stdin, File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tornado/gen.py", line 209, in wrapper yielded = next(result) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 300, in do_execute res = shell.run_cell(code, store_history=store_history, silent=silent) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/ipykernel/zmqshell.py", line 536, in run_cell return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2867, in run_cell raw_cell, store_history, silent, shell_futures) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2895, in _run_cell return runner(coro) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/IPython/core/async_helpers.py", line 68, in _pseudo_sync_runner coro.send(None) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3072, in run_cell_async interactivity=interactivity, compiler=compiler, result=result) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3263, in run_ast_nodes if (await self.run_code(code, result, async_=asy)): File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3343, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 10, in img = gan.infer(picture) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/UGATIT/UGATIT.py", line 676, in infer self.saver = tf.train.Saver() File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/training/saver.py", line 828, in __init__ self.build() File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/training/saver.py", line 840, in build self._build(self._filename, build_save=True, build_restore=True) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/training/saver.py", line 878, in _build build_restore=build_restore) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/training/saver.py", line 508, in _build_internal restore_sequentially, reshape) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/training/saver.py", line 328, in _AddRestoreOps restore_sequentially) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/training/saver.py", line 575, in bulk_restore return io_ops.restore_v2(filename_tensor, names, slices, dtypes) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/ops/gen_io_ops.py", line 1696, in restore_v2 name=name) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/framework/op_def_library.py", line 794, in _apply_op_helper op_def=op_def) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/util/deprecation.py", line 507, in new_func return func(*args, **kwargs) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 3357, in create_op attrs, op_def, compute_device) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 3426, in _create_op_internal op_def=op_def) File "/media/M_fM__VM__GM_fM_!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 1748, in __init__ self._traceback = tf_stack.extract_stack() So i think: when i download the no.204 model, it show me model size is about 8G, but after downloading, on 3~4 G ! some loss ?
luoww1992 commented 3 years ago

在UGATIT.py的第603行,我添加了一个修复程序来加载检查点。如果没有任何输出,cat UGATIT.py | grep UGATIT.model-2044000则表示您没有从存储库中提取最新更改。

when i run it with default settings, i get it:

[] Reading checkpoints... 2020-11-05 17:56:31.540348: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at save_restore_v2_ops.cc:184 : Out of range: Read less bytes than requested Traceback (most recent call last): File "/media/M_fMVMGMfM!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1365, in _do_call return fn(args) File "/media/M_fMVMGMfM!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1350, in _run_fn target_list, run_metadata) File "/media/M_fMVMGMfM!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.OutOfRangeError: Read less bytes than requested [[{{node save/RestoreV2}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/media/M_fMVMGMfM!M_#/lww/Py36/FaceStyle003/UGATIT/demo.py", line 23, in img = gan.infer(picture) File "/media/M_fMVMGMfM!M_#/lww/Py36/FaceStyle003/UGATIT/UGATIT.py", line 677, in infer could_load, checkpoint_counter = self.load(self.checkpoint_dir) File "/media/M_fMVMGMfM!M_#/lww/Py36/FaceStyle003/UGATIT/UGATIT.py", line 612, in load self.saver.restore(self.sess, os.path.join(checkpoint_dir, ckpt_name)) File "/media/M_fMVMGMfM!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/training/saver.py", line 1290, in restore {self.saver_def.filename_tensor_name: save_path}) File "/media/M_fMVMGMfM!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 956, in run run_metadata_ptr) File "/media/M_fMVMGMfM!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1180, in _run feed_dict_tensor, options, run_metadata) File "/media/M_fMVMGMfM!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1359, in _do_run run_metadata) File "/media/M_fMVMGMfM!M_#/lww/Py36/FaceStyle003/lib/python3.6/site-packages/tensorflow_core/python/client/session.py", line 1384, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.OutOfRangeError: Read less bytes than requested [[node save/RestoreV2 (defined at /lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:1748) ]]

what happened ?