elleryqueenhomels / fast_neural_style_transfer Goto Github PK
View Code? Open in Web Editor NEWGenerative Neural Methods Based On Model Iteration
License: MIT License
Generative Neural Methods Based On Model Iteration
License: MIT License
Hi, thanks for such fast model, I have tried your code and followed steps. So, initially I am getting this error:
TypeError: Cannot handle this data type: (1, 1, 3), <f4
Traceback (most recent call last): File "F:\ai\deep\fast_neural_style_transfer-dev\main.py", line 71, in <module> main() File "F:\ai\deep\fast_neural_style_transfer-dev\main.py", line 64, in main generated_images = generate(content_targets, model_path, save_path=output_save_path, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\ai\deep\fast_neural_style_transfer-dev\generate.py", line 23, in generate outputs = _handler2(contents_path, model_path, save_path=save_path, prefix=prefix, suffix=suffix) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "F:\ai\deep\fast_neural_style_transfer-dev\generate.py", line 72, in _handler2 save_images(content_path, output, save_path, prefix=prefix, suffix=suffix) File "F:\ai\deep\fast_neural_style_transfer-dev\utils.py", line 61, in save_images imsave(path, data) File "C:\Users\Najm Abideen\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\imageio\v2.py", line 397, in imwrite return file.write(im, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Najm Abideen\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\imageio\plugins\pillow.py", line 425, in write pil_frame = Image.fromarray(frame, mode=mode) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Najm Abideen\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\PIL\Image.py", line 3073, in fromarray raise TypeError(msg) from e TypeError: Cannot handle this data type: (1, 1, 3), <f4
I skipped the error and tried to show the result using:
plt.imshow(result[0], interpolation='nearest')
plt.show()
but generated result[0] is an empty image, I have seen very little generated noise on following styles:
Actually, I have tried all of your pre trained 10 models.
Have also placed the weights file, "imagenet-vgg-verydeep-19.mat" & "imagenet-vgg-19-weights.npz".
I finally was able to save the image using:
if save_path is not None:
for i, image in enumerate(output):
# Convert image to the appropriate data type and scale it to 0-255
image_scaled = (image * 255).astype(np.uint8)
# Save the image using imageio
filename = f"{prefix}_{i}_{suffix}.png" if prefix and suffix else f"image_{i}.png"
imageio.imwrite(f"{save_path}/{filename}", image_scaled)
#save_images(content_path, output_converted, save_path, prefix=prefix, suffix=suffix)
but images are simply nothing but noise:
Kindly help really appreciate, I don't know why I found this code so late :)
Hello, the MS COCO dataset you provided cannot be downloaded. Could you please fix it?
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.