five

piebro/factorio-blueprint-visualizations

收藏
Hugging Face2023-12-08 更新2024-03-04 收录
下载链接:
https://hf-mirror.com/datasets/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 ![](png_1024x1024/image_38.png) ![](png_1024x1024/image_39.png) ## 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 ```
提供机构:
piebro
原始信息汇总

数据集描述

该数据集是使用Factorio Visualization ToolFactorio 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

5,000+
优质数据集
54 个
任务类型
进入经典数据集
二维码
社区交流群

面向社区/商业的数据集话题

二维码
科研交流群

面向高校/科研机构的开源数据集话题

数据驱动未来

携手共赢发展

商业合作