💡 [REQUEST] - Neural Style Transfer: change layers to compute style/content
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 55/100
- Issue 类型
- 文档
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- python
调研方向
从链接的 Neural Style Transfer 教程及其中对目标深度层的定义开始。将教程中的连续层名称与文章中分组的 VGG 层进行比较,然后验证文档中记录的风格层和内容层选择是否与引用的论文一致,并产生教程预期的行为。
由索引模型根据 Issue 内容生成。
描述
🚀 Describe the improvement or the new tutorial
I tried using code from Neural Style Transfer tutorial to apply a van Gogh style to my photo, and results were way poorer copared to what I've seen on DeepArt.io.
Luckily, I found what's the issue, and how to improve quality.
Original paper states:
Thus, the visually
most appealing images are usually created by matching the
style representation up to high layers in the network, which
is why for all images shown we match the style features
in layers ‘conv1_1’, ‘conv2_1’, ‘conv3_1’, ‘conv4_1’ and
‘conv5_1’ of the network.
and also:
The images shown in Fig 3
were synthesised by matching the content representation
on layer ‘conv4_2’ and the style representation on layers
‘conv1_1’, ‘conv2_1’, ‘conv3_1’, ‘conv4_1’ and ‘conv5_1’
In the tutorial, layer conv_4 is used for content and layers from conv_1 to conv_5 for style.:
# desired depth layers to compute style/content losses :
content_layers_default = ['conv_4']
style_layers_default = ['conv_1', 'conv_2', 'conv_3', 'conv_4', 'conv_5']
At first glance everything looks fine, but indexing patterns are different: in the article (and original VGG model) layers were split into groups between poolings, and in the tutorial a continuous numbering is used.
| Article | Tutorial |
|---|---|
| conv1_1 | conv_1 |
| conv1_2 | conv_2 |
| --- | --- |
| conv2_1 | conv_3 |
| conv2_2 | conv_4 |
| --- | --- |
| conv3_1 | conv_5 |
| conv3_2 | conv_6 |
| conv3_3 | conv_7 |
| conv3_4 | conv_8 |
| --- | --- |
| conv4_1 | conv_9 |
| conv4_2 | conv_10 |
| conv4_3 | conv_11 |
| conv4_4 | conv_12 |
| --- | --- |
| conv5_1 | conv_13 |
| conv5_2 | conv_14 |
| conv5_3 | conv_15 |
| conv5_4 | conv_16 |
So layers conv_1, conv_3, conv_5, conv_9 and conv_13 should be used for style and layer conv_10 for content.
That produces way better results.
Suggested change
# desired depth layers to compute style/content losses :
content_layers_default = ['conv_10']
style_layers_default = ['conv_1', 'conv_3', 'conv_5', 'conv_9', 'conv_13']
Existing tutorials on this topic
https://docs.pytorch.org/tutorials/advanced/neural_style_tutorial.html
Additional context
Another suggestion to improve quality: #3731
cc @albanD @jbschlosser
- 主要语言
- Python
- 星标
- 9.5k
- 派生
- 4.5k
- 平均合并
- 1 天 20 小时
- 30 天内合并 PR
- 2
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pytorch/tutorials 的其他 Issue
-
module: vulkan
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
Feedback about Datasets & DataLoaders可能已有人在做 @hippi345 于 47 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 2 天内回复
-
💡 [REQUEST] - Add model.eval() after loading the mdoel可能已有人在做 @Justee21 于 71 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 78/100
维护者通常 2 天内回复
-
[BUG] Captum tutorial fails when visualize_image_attr() receives None for original_image可能已有人在做 @manjirisharma 于 41 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
pytorch/tutorials#3963 · 1 条评论 ·
维护者通常 2 天内回复
-
[BUG] - Incorrect ResNet18 preprocessing in Captum tutorial可能已有人在做 @austxu 于 130 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 2 天内回复
查看 pytorch/tutorials 的全部 Issue
相似的 Issue
-
needs-triage
难度 2/5 1-3 小时 新手友好度 86/100
MakazhanAlpamys/Soup#3589 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
ClickHouse/clickhouse-connect#1266 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
biosustain/growthcurves_app#89 ·
维护者通常 1 天内回复
-
`LogProxyConsumer._on_relation_departed` raises `APIError` when the promtail service does not exist未关闭
难度 2/5 1-3 小时 新手友好度 78/100
canonical/loki-k8s-operator#695 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复