-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using custom / pres-selected images option #2
Comments
Hi Limbicnation, thanks for your interest in the project. Yes, it would be fairly easy to create a collage from custom images. You just need to fill up But first, you should make a copy of the colab to your google drive to save your work. Then, if not needed, comment out the code to collect images from Wikimedia and Open Images, from lines 30 to 104 in the Find Source Images block. Then add code like this after line 104:
Note that I didn't test this so there may be some typos/bugs in the code. If you put some jpg files in /content/custom_images, the system will pick them up and use them for the collage. Cheer, |
Hi Rob, thank you very much for your reply! I really appreciate your help. Best, Gero |
Hi again Rob, I am trying to run the notebook locally, by converting to python. However, I get the following error:
Is there a way I can fix this? |
Yeah, the /content folder is effectively the root folder for the project running on a Colab. To fix this, just replace all instances of “/content” with the name of your local root folder for the project, i.e., “/media/-/Data-ml1/ML_Images/CLIPandPASTE” |
Thank you for your help! |
Unfortunately now I am getting another error:
I think this is too high-level for me, to get this code running locally. :) I changed the path pointing to the file to the Root directory of the project. |
Unfortunately I am not familiar with this error. |
Hi, both of these errors seem to be stemming from a problem with the file paths. The np.stack() call is probably failing because it didn't find any images to process. |
Hi Rob, thank you for your help. I've now gotten it up and running to the point where the images are being analyzed and cropped accordingly. But I don't know how this can be further automated in the code, I still exclude some code that might be necessary I think. I now have to click away each image so the process can continue. Thanks! |
Hi Gero, Nice work! Yes, it is possible to do both of the things you are asking about. Resizing the elements is easier. This can be done by changing the number 512 used in lines 300 to 303 in the Find Source Images block. The code currently resizes any image with a width or height greater than 512 down to 512, preserving the aspect ratio. Depending on how big your images are, changing all of the 512s to be smaller will make everything smaller, and making it bigger will make everything bigger. You could replace all the 512s with an image_size variable and play with it. Or, if that doesn't work for you, could rewrite the block and do something different. Using transparency would be a bit harder. First, I convert am currently forcing all images to be in Hope this helps. Cheers,
|
Hi Rob, thanks for your help! I think the alpha images are a bit too difficult for me. How can I get more control over the background gradient? I need some insight into this script please. Thanks! Cheers, |
Hi, if you haven’t seen it yet you should read my write up on Medium first. This has a section on how creating the background gradient image works. There are a lot of ways to extend this. What type of additional controls are you looking for? |
Hi Rob, thanks for sharing the Link! I've already looked at it, but my python skills are not up to standard. I would like to control the colors or create patterns like with Perlin Noise e.g. sorry if I ask again and if that topic was already explained in the article. |
Hi Gero, Yes, good idea! Using Perlin noise would work well. You could code it up to have Adam modify parameters like the number of octaves (for scaling), the y and x offsets (for translation), and even add a z offset (for perturbing the form). Here's some code to start with.
There may be a faster way to generate Perlin Noise, but this seems to work ok.
|
Hi Rob, thank you for your message. I'm not sure where to insert this code. Thanks! |
Hi Gero, Yeah, you need to remove the spline color generator and add this code. And the Adam optimizer needs to be configured to change the octaves and offsets variables. If I have time, I’ll add this to the Colab as an option. Cheers,
|
Hi Rob, If you have the time, I would be very grateful, if you could help me implement the code. Thank you! |
Hello, great notebook! Is it possible to use your own / pres-selected or custom pictures? If so, where would I adapt the code? Thanks very much!
The text was updated successfully, but these errors were encountered: