mintanwei / cycle-ir Goto Github PK
View Code? Open in Web Editor NEWThis is a Tensorflow implementation of Cycle-IR approach for content-aware image retargeting.
This is a Tensorflow implementation of Cycle-IR approach for content-aware image retargeting.
train_CycleIR.py以及test_CycleIR.py文件缺失,checkpoint训练好的模型文件也缺失,工作无法复现!
Hello, do you intend to release weights or at least the train_CycleIR.py
file? One of these (preferably the weights) would be required to compare to your method.
Hi, I want to use this code for inference. I couldn't run this code and author didn't share pretrained model but, I different article, they used this method for comparison. How I can do that?
Anybody can help me?
@mintanwei
Hi. if you could run and train the model please let me know? I need any codes can be train.
Anybody could implement these code with tensorflow 2.x.
@mintanwei
Traceback (most recent call last):
File "/home/Anaconda3/envs/tf18/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1322, in _do_call
return fn(*args)
File "/home/Anaconda3/envs/tf18/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1307, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/home/Anaconda3/envs/tf18/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1409, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Requested more than 0 entries, but params is empty. Params shape: [0,0,3]
[[Node: while/GatherNd_2 = GatherNd[Tindices=DT_INT32, Tparams=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"](while/transpose_1, while/stack_3/_10383)]]
[[Node: while_3/cond_1/while/cond/mul_8/_10811 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_29310_while_3/cond_1/while/cond/mul_8", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "train_CycleIR.py", line 208, in
tf.app.run()
File "/home/Anaconda3/envs/tf18/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "train_CycleIR.py", line 196, in main
_, generator_loss = sess.run([opt_g, CycleLoss], feed_dict=feed_dict)
File "/home/Anaconda3/envs/tf18/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 900, in run
run_metadata_ptr)
File "/home/Anaconda3/envs/tf18/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1135, in _run
feed_dict_tensor, options, run_metadata)
File "/home/Anaconda3/envs/tf18/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1316, in _do_run
run_metadata)
File "/home/Anaconda3/envs/tf18/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1335, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Requested more than 0 entries, but params is empty. Params shape: [0,0,3]
[[Node: while/GatherNd_2 = GatherNd[Tindices=DT_INT32, Tparams=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"](while/transpose_1, while/stack_3/_10383)]]
[[Node: while_3/cond_1/while/cond/mul_8/_10811 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_29310_while_3/cond_1/while/cond/mul_8", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]]
Caused by op 'while/GatherNd_2', defined at:
File "train_CycleIR.py", line 208, in
tf.app.run()
File "/home/Anaconda3/envs/tf18/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "train_CycleIR.py", line 160, in main
opt_g, aspect_ratio, images, CycleLoss, images_LR, AttentionMap, input_size, Sh, Sw = build_graph()
File "train_CycleIR.py", line 80, in build_graph
images_LR = reconstruct_image(images, Sh, Sw, input_size, aspect_ratio)
File "/home/zm/wd/Cycle-IR/Circle_reconstruct_image.py", line 85, in reconstruct_image
ta_final_result = resize_images(images, aspect_ratio, input_size, B, M, N, newH, newW)
File "/home/zm/wd/Cycle-IR/Circle_reconstruct_image.py", line 38, in resize_images
n, img_final = tf.while_loop(condition, body, init_state)
File "/home/Anaconda3/envs/tf18/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 3224, in while_loop
result = loop_context.BuildLoop(cond, body, loop_vars, shape_invariants)
File "/home/Anaconda3/envs/tf18/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2956, in BuildLoop
pred, body, original_loop_vars, loop_vars, shape_invariants)
File "/home/Anaconda3/envs/tf18/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2893, in _BuildLoop
body_result = body(*packed_vars_for_body)
File "/home/zm/wd/Cycle-IR/Circle_reconstruct_image.py", line 35, in body
ta_final_result = ResizeImage(ta_final_result, tf.constant([1., 0, 0, 0, 1., 0]), out_dims=out_dims)
File "/home/zm/wd/Cycle-IR/image_resizing.py", line 14, in ResizeImage
out_fmap = bilinear_sampler(input_fmap, x_s, y_s)
File "/home/zm/wd/Cycle-IR/image_resizing.py", line 72, in bilinear_sampler
Ic = get_pixel_value(img, x1, y0) # x0, y0-1
File "/home/zm/wd/Cycle-IR/image_resizing.py", line 20, in get_pixel_value
return tf.gather_nd(img, indices)
File "/home/Anaconda3/envs/tf18/lib/python3.5/site-packages/tensorflow/python/ops/gen_array_ops.py", line 2975, in gather_nd
"GatherNd", params=params, indices=indices, name=name)
File "/home/Anaconda3/envs/tf18/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/Anaconda3/envs/tf18/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
op_def=op_def)
File "/home/Anaconda3/envs/tf18/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1718, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access
InvalidArgumentError (see above for traceback): Requested more than 0 entries, but params is empty. Params shape: [0,0,3]
[[Node: while/GatherNd_2 = GatherNd[Tindices=DT_INT32, Tparams=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"](while/transpose_1, while/stack_3/_10383)]]
[[Node: while_3/cond_1/while/cond/mul_8/_10811 = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_29310_while_3/cond_1/while/cond/mul_8", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]]
As far as I know this is the only project to do image retargeting with deep-learning.
Really interested to see it working..
Done with all requirements
Donwloaded vgg16.npy and vgg16.py from https://github.com/machrisaa/tensorflow-vgg in VGG_MODEL folder
commented out all assert instructions from vgg16.py
Now stuck with this error
ubuntu@vega:~/Cycle-IR$ python3 CycleIR.py
npy file loaded
build model started
Traceback (most recent call last):
File "CycleIR.py", line 204, in
tf.app.run()
File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "CycleIR.py", line 190, in main
opt_g, aspect_ratio, images, CycleLoss, images_LR, AttentionMap, input_size, Sh, Sw = build_graph()
File "CycleIR.py", line 93, in build_graph
Sh, Sw, AttentionMap = CycleIR(images, reuse=False)
File "CycleIR.py", line 27, in CycleIR
vgg.build(images)
File "/home/ubuntu/Cycle-IR/VGG_MODEL/vgg16.py", line 69, in build
self.fc6 = self.fc_layer(self.pool5, "fc6")
File "/home/ubuntu/Cycle-IR/VGG_MODEL/vgg16.py", line 106, in fc_layer
dim *= d
TypeError: unsupported operand type(s) for *=: 'int' and 'NoneType'
你好,请问这个工作的论文有上传到arXiv吗?
Hi,
I try to implement your code.
I downloaded VGG16 model from https://github.com/machrisaa/tensorflow-vgg and put it in my_vgg folder. However, when I run the program, it shows the log like this. Could you help me with this error? Thank you.
E:\ProgramData\Anaconda3\lib\site-packages\h5py\__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from
floatto
np.floatingis deprecated. In future, it will be treated as
np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
npy file loaded
build model started
Traceback (most recent call last):
File "", line 1, in
runfile('F:/code/Cycle-IR-master/Cycle-IR-master/train_CycleIR.py', wdir='F:/code/Cycle-IR-master/Cycle-IR-master')
File "E:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
execfile(filename, namespace)
File "E:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "F:/code/Cycle-IR-master/Cycle-IR-master/train_CycleIR.py", line 208, in
tf.app.run()
File "E:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "F:/code/Cycle-IR-master/Cycle-IR-master/train_CycleIR.py", line 160, in main
opt_g, aspect_ratio, images, CycleLoss, images_LR, AttentionMap, input_size, Sh, Sw = build_graph()
File "F:/code/Cycle-IR-master/Cycle-IR-master/train_CycleIR.py", line 79, in build_graph
Sh, Sw, AttentionMap = CycleIR(images, reuse=False)
File "F:/code/Cycle-IR-master/Cycle-IR-master/train_CycleIR.py", line 22, in CycleIR
vgg.build(images)
File "F:\code\Cycle-IR-master\Cycle-IR-master\VGG_MODEL\vgg16.py", line 36, in build
assert red.get_shape().as_list()[1:] == [224, 224, 1]
AssertionError`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.