TZYSJTU / Sketch-Generation-with-Drawing-Process-Guided-by-Vector-Flow-and-Grayscale

This is the official implementation of the AAAI 2021 accepted paper "Sketch Generation with Drawing Process Guided by Vector Flow and Grayscale"
Creative Commons Zero v1.0 Universal
288 stars 61 forks source link

Google Colab version #3

Open cedro-3 opened 3 years ago

cedro-3 commented 3 years ago

Would you please publish the Google Colab version? I think that if you have the Google Colab version, you can appeal to more people.

benearnthof commented 3 years ago

For future reference: All that is needed to run this repository in Google Colab is to remove or comment out all the calls to cv2.imshow, since you can't open external windows in Colab. I've forked this repo and added these changes. You can find a minimal version of running the cat script here: https://colab.research.google.com/drive/1TCKZg3FxJepnmcZE7Xjef6_BHmvzdmbb?usp=sharing If you want to process your own images simply upload them with a unique name to the 'input' directory and change the variable name in the corresponding script. For example: Upload 'yourimage.png' to the 'input' directory If we would like to use 'process_order.py' we change the args line in the file from

# args
input_path = './input/your file'

to

# args
input_path = './input/yourimage.png'

and run !python process_order.py in a code cell after saving the changes. You can, of course, also change the parameters to your liking. The output images will be located in the 'output' directory in their own folder.

cedro-3 commented 3 years ago

I immediately tried to move the code. Great! Now you know how to run it in Google Colab. Thank you for your support.

David Ly

2021/01/03 20:28、benearnthof notifications@github.comのメール:

For future reference: All that is needed to run this repository in Google Colab is to remove or comment out all the calls to cv2.imshow, since you can't open external windows in Colab. I've forked this repo and added these changes. You can find a minimal version of running the cat script here: https://colab.research.google.com/drive/1TCKZg3FxJepnmcZE7Xjef6_BHmvzdmbb?usp=sharing https://colab.research.google.com/drive/1TCKZg3FxJepnmcZE7Xjef6_BHmvzdmbb?usp=sharing If you want to process your own images simply upload them with a unique name to the 'input' directory and change the variable name in the corresponding script. For example: Upload 'yourimage.png' to the 'input' directory If we would like to use 'process_order.py' we change the args line in the file from

args

input_path = './input/your file' to

args

input_path = './input/yourimage.png' and run !python process_order.py in a code cell after saving the changes. You can, of course, also change the parameters to your liking. The output images will be located in the 'output' directory in their own folder.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/TZYSJTU/Sketch-Generation-with-Drawing-Process-Guided-by-Vector-Flow-and-Grayscale/issues/3#issuecomment-753602842, or unsubscribe https://github.com/notifications/unsubscribe-auth/AITR47QTZRWOXZDYK2YZT7LSYBIHFANCNFSM4VCJTT2Q.

goodwin74 commented 2 years ago

I tried to make my own Colab notepad first, but got an error. I saw this thread and tried to run the above mentioned Colab. But there is the same error. What to do?

ETF/edge_tangent_flow.py", line 12, in init self.origin_shape = img.shape AttributeError: 'NoneType' object has no attribute 'shape'

benearnthof commented 2 years ago

I tried to make my own Colab notepad first, but got an error. I saw this thread and tried to run the above mentioned Colab. But there is the same error. What to do?

ETF/edge_tangent_flow.py", line 12, in init self.origin_shape = img.shape AttributeError: 'NoneType' object has no attribute 'shape'

the img object created by the cv2.imread function in the code you mentioned is supposed to return an image. The Error you encountered means that cv2.imread must have returned nothing or an object of type "NoneType". So I suspect you're trying to read images in the wrong file format. Try the stuff suggested here: and see what the cv2.imread function returns.

goodwin74 commented 2 years ago

I tried to make my own Colab notepad first, but got an error. I saw this thread and tried to run the above mentioned Colab. But there is the same error. What to do?

ETF/edge_tangent_flow.py", line 12, in init self.origin_shape = img.shape AttributeError: 'NoneType' object has no attribute 'shape'

the img object created by the cv2.imread function in the code you mentioned is supposed to return an image. The Error you encountered means that cv2.imread must have returned nothing or an object of type "NoneType". So I suspect you're trying to read images in the wrong file format. Try the stuff suggested here: and see what the cv2.imread function returns.

Thanks! Is it possible to generate one final image? Is it possible to turn off the animation so as not to waste extra resources and speed up drawing?

benearnthof commented 2 years ago

Thanks! Is it possible to generate one final image? Is it possible to turn off the animation so as not to waste extra resources and speed up drawing?

The relevant line controlling this in the process_order.py file can be found here the Freq variable controls how frequently images are saved. If you set Freq to the total number of iterations only one final image should be generated.