piebro/factorio-blueprint-visualizations
收藏资源简介:
--- license: cc0-1.0 task_categories: - text-to-image tags: - art pretty_name: Factorio Blueprint Visualizations Dataset size_categories: - n<1K --- ## Dataset Description This dataset is a collection of visualizations of [Factorio Blueprints](https://wiki.factorio.com/Blueprint) using this Factorio Visualization Tool: https://github.com/piebro/factorio-blueprint-visualizer. The Blueprints are collected from https://www.factorio.school/. ## Examples   ## Dataset Structure * "svg_original": The svg downloaded like this from the website * "svg_rect": The svg reshaped to a rect and a slightly bigger border * "png_1024x1024": The svg_rect images exported as pngs ## Additional Information The dataset was used to train this lora: https://huggingface.co/piebro/factorio-blueprint-visualizations-sdxl-lora ## Code Attachments Code to create the rectangular svgs: ```python import os import xml.etree.ElementTree as ET def modify_svg(save_dir, svg_file_path): tree = ET.parse(svg_file_path) root = tree.getroot() # Extract current width and height width = float(root.attrib['width'].replace('mm', '')) height = float(root.attrib['height'].replace('mm', '')) # Calculate new dimensions new_size = max(width, height) + 200 # Update width and height root.attrib['width'] = f"{new_size}mm" root.attrib['height'] = f"{new_size}mm" # Adjust viewBox for centering content view_box = root.attrib.get('viewBox', '').split(',') if len(view_box) == 4: x, y, vw, vh = map(float, view_box) dx = vw*0.12 dy = vh*0.12 root.attrib['viewBox'] = f"{x-dx/2}, {y-dy/2}, {vw+dx}, {vh+dy}" # Write back to file or a new file tree.write(os.path.join(save_dir, f"modified_{os.path.basename(svg_file_path)}")) save_dir = "" original_svg_folder_path = "" for file_name in os.listdir(original_svg_folder_path): if file_name.endswith('.svg'): modify_svg(save_dir, os.path.join(original_svg_folder_path, file_name)) ``` Code to create the pngs: ```bash mkdir pngs for file in *.svg; do convert "$file" -resize 1024x1024 "pngs/${file%.svg}.png"; done ```
许可证:CC0 1.0 任务类别: - 文本到图像 标签: - 艺术 友好名称:异星工厂蓝图可视化数据集(Factorio Blueprint Visualizations Dataset) 规模类别: - 样本量小于1000(n<1K) ## 数据集描述 本数据集为使用异星工厂蓝图可视化工具(Factorio Blueprint Visualization Tool,链接:https://github.com/piebro/factorio-blueprint-visualizer)生成的异星工厂(Factorio)蓝图可视化作品集合,蓝图数据均采集自https://www.factorio.school/。 ## 示例   ## 数据集结构 * "svg_original": 从网站直接下载的原始SVG文件 * "svg_rect": 调整为矩形并添加稍大边框的SVG文件 * "png_1024x1024": 将svg_rect格式的图像导出为分辨率1024×1024的PNG文件 ## 附加信息 本数据集曾用于训练该低秩适配(LoRA):https://huggingface.co/piebro/factorio-blueprint-visualizations-sdxl-lora ## 代码附件 生成矩形SVG的代码: python import os import xml.etree.ElementTree as ET def modify_svg(save_dir, svg_file_path): tree = ET.parse(svg_file_path) root = tree.getroot() # Extract current width and height width = float(root.attrib['width'].replace('mm', '')) height = float(root.attrib['height'].replace('mm', '')) # Calculate new dimensions new_size = max(width, height) + 200 # Update width and height root.attrib['width'] = f"{new_size}mm" root.attrib['height'] = f"{new_size}mm" # Adjust viewBox for centering content view_box = root.attrib.get('viewBox', '').split(',') if len(view_box) == 4: x, y, vw, vh = map(float, view_box) dx = vw*0.12 dy = vh*0.12 root.attrib['viewBox'] = f"{x-dx/2}, {y-dy/2}, {vw+dx}, {vh+dy}" # Write back to file or a new file tree.write(os.path.join(save_dir, f"modified_{os.path.basename(svg_file_path)}")) save_dir = "" original_svg_folder_path = "" for file_name in os.listdir(original_svg_folder_path): if file_name.endswith('.svg'): modify_svg(save_dir, os.path.join(original_svg_folder_path, file_name)) 生成PNG的代码: bash mkdir pngs for file in *.svg; do convert "$file" -resize 1024x1024 "pngs/${file%.svg}.png"; done
数据集描述
该数据集是使用Factorio Visualization Tool对Factorio Blueprints进行可视化的集合。这些蓝图是从Factorio School收集的。
示例

数据集结构
- "svg_original": 从网站下载的原始svg文件
- "svg_rect": 重新调整为矩形并带有稍大边界的svg文件
- "png_1024x1024": 将svg_rect图像导出为png格式
附加信息
该数据集用于训练此lora模型:Factorio Blueprint Visualizations SDXL LoRA
代码附件
创建矩形svg的代码: python import os import xml.etree.ElementTree as ET
def modify_svg(save_dir, svg_file_path): tree = ET.parse(svg_file_path) root = tree.getroot()
# Extract current width and height
width = float(root.attrib[width].replace(mm, ))
height = float(root.attrib[height].replace(mm, ))
# Calculate new dimensions
new_size = max(width, height) + 200
# Update width and height
root.attrib[width] = f"{new_size}mm"
root.attrib[height] = f"{new_size}mm"
# Adjust viewBox for centering content
view_box = root.attrib.get(viewBox, ).split(,)
if len(view_box) == 4:
x, y, vw, vh = map(float, view_box)
dx = vw*0.12
dy = vh*0.12
root.attrib[viewBox] = f"{x-dx/2}, {y-dy/2}, {vw+dx}, {vh+dy}"
# Write back to file or a new file
tree.write(os.path.join(save_dir, f"modified_{os.path.basename(svg_file_path)}"))
save_dir = "" original_svg_folder_path = "" for file_name in os.listdir(original_svg_folder_path): if file_name.endswith(.svg): modify_svg(save_dir, os.path.join(original_svg_folder_path, file_name))
创建png的代码: bash mkdir pngs for file in *.svg; do convert "$file" -resize 1024x1024 "pngs/${file%.svg}.png"; done




