Browse Source

Repository improvements, Github Actions and release script

tags/v1.2.5
Ivan Bravo Bravo 10 months ago
parent
commit
a40e51054a

+ 13
- 0
.editorconfig View File

@@ -0,0 +1,13 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

+ 12
- 0
.github/FUNDING.yml View File

@@ -0,0 +1,12 @@
# These are supported funding model platforms

#github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: deepmanyy # Replace with a single Patreon username
#open_collective: # Replace with a single Open Collective username
ko_fi: deepmanyy # Replace with a single Ko-fi username
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
#liberapay: # Replace with a single Liberapay username
#issuehunt: # Replace with a single IssueHunt username
#otechie: # Replace with a single Otechie username
#custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

+ 32
- 0
.github/ISSUE_TEMPLATE/bug_report.md View File

@@ -0,0 +1,32 @@
---
name: Bug report
about: Help us improve by reporting any problem.
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Enviroment (please complete the following information):**
- Version [e.g. 1.0.0]
- OS: [e.g. Windows 10 1803]
- Report URL: [If applicable, e.g. https://rollbar.com/occurrence/...]

**Additional context**
Add any other context about the problem here.

+ 20
- 0
.github/ISSUE_TEMPLATE/feature_request.md View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for DreamPower
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

+ 17
- 0
.github/stale.yml View File

@@ -0,0 +1,17 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

+ 141
- 0
.github/workflows/ci.yml View File

@@ -0,0 +1,141 @@
name: CI

on:
push:
branches:
- master
- canary
- ivan
tags:
- v*

pull_request:
branches:
- canary

jobs:
build:
name: Build (${{ matrix.os-short }}-${{ matrix.device }})
runs-on: ${{ matrix.os }}

# Strategy
# or a.k.a variables for multiple platforms
# https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstrategy
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macOS-latest
device:
- any
- cpuonly

include:
- os: ubuntu-latest # Ubuntu
os-short: ubuntu
os-ext: deb
python: python3
- os: ubuntu-latest # Ubuntu & GPU
device: any
torch-version: https://download.pytorch.org/whl/cu100/torch-1.1.0-cp37-cp37m-linux_x86_64.whl
- os: ubuntu-latest # Ubuntu & CPU
device: cpuonly
setup-args: --cpu
torch-version: https://download.pytorch.org/whl/cpu/torch-1.1.0-cp37-cp37m-linux_x86_64.whl
- os: windows-latest # Windows
os-short: windows
os-ext: exe
python: python
pyinstaller-args: --add-binary "../third/msvcp/msvcp140.dll;."
- os: windows-latest # Windows & GPU
device: any
torch-version: https://download.pytorch.org/whl/cu100/torch-1.1.0-cp37-cp37m-win_amd64.whl
- os: windows-latest # Windows & CPU
device: cpuonly
setup-args: --cpu
torch-version: https://download.pytorch.org/whl/cpu/torch-1.1.0-cp37-cp37m-win_amd64.whl
- os: macOS-latest # macOS
os-short: macos
os-ext: dmg
python: python3
setup-args: --cpu
torch-version: torch

exclude:
- os: macOS-latest
device: any

steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
continue-on-error: true

- uses: actions/checkout@v1
with:
submodules: true

- name: Use Python 3.7
uses: actions/setup-python@v1
if: runner.os != 'macOS'
with:
python-version: 3.7
architecture: x64

- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Use Yarn
run: npm install -g yarn

- name: Setup - Release Script
working-directory: scripts
run: |
yarn install

- name: Setup - DreamPower
if: false
run: |
${{ matrix.python }} -m pip install pyinstaller
${{ matrix.python }} -m pip install numpy==1.16.4
${{ matrix.python }} -m pip install pillow==6.1.0
${{ matrix.python }} -m pip install opencv-python==4.1.0.25
${{ matrix.python }} -m pip install rsa==4.0
${{ matrix.python }} -m pip install imageio==2.5.0
${{ matrix.python }} -m pip install python-dotenv==0.10.3
${{ matrix.python }} -m pip install rook==0.1.73
${{ matrix.python }} -m pip install sentry-sdk==0.10.2
${{ matrix.python }} -m pip --no-cache-dir install ${{ matrix.torch-version }}
${{ matrix.python }} -m pip --no-cache-dir install torchvision==0.2.2.post3

- name: Setup - DreamPower
working-directory: scripts
run: |
${{ matrix.python }} setup.py --debug --pip_no_cache_dir ${{ matrix.setup-args }}

- name: Build - DreamPower
if: false
run: |
${{ matrix.python }} -m PyInstaller main.py -y --onedir --name "dreampower" --distpath "../../dist" ${{ matrix.pyinstaller-args }}

- name: Build - DreamPower
working-directory: scripts
run: |
${{ matrix.python }} build.py --debug

- name: Deploy
working-directory: scripts
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_REF: ${{ github.ref }}
S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
BUILD_DEVICE: ${{ matrix.device }}
run: |
node release.js

+ 13
- 3
.gitignore View File

@@ -3,9 +3,9 @@ logs
*.log

# Process Images
*.png
*.jpg
*.gif
/*.png
/*.jpg
/*.gif
altered/

# Runtime data
@@ -26,6 +26,16 @@ checkpoints/
# Build
build/

# node_modules
scripts/node_modules/

# release script
.eslintrc.js
.prettierrc
*.tar.gz
*.7z
*.lock

# Build Configuration
*.spec


+ 9
- 0
.vscode/settings.json View File

@@ -0,0 +1,9 @@
{
"editor.tabSize": 4,

"files.eol": "\n",
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": false,
"jira-plugin.workingProject": "",
"python.pythonPath": "C:\\Program Files\\Python36\\python.exe"
}

LICENSE.md → LICENSE View File


+ 72
- 47
README.md View File

@@ -1,58 +1,92 @@
![](assets/dreampower.png)

[![Build Status](https://github.com/private-dreamnet/dreampower/workflows/CI/badge.svg)](https://github.com/private-dreamnet/dreampower/actions)
[![GitHub All Releases](https://img.shields.io/github/downloads/private-dreamnet/dreampower/total?logo=github&logoColor=white)](https://github.com/private-dreamnet/dreampower/releases)

![GitHub](https://img.shields.io/github/license/private-dreamnet/dreampower)
![GitHub top language](https://img.shields.io/github/languages/top/private-dreamnet/dreampower)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/fcea261a567c47109419d0572160fecf)](https://www.codacy.com/app/kolessios/dreampower?utm_source=github.com&utm_medium=referral&utm_content=private-dreamnet/dreampower&utm_campaign=Badge_Grade)
[![Maintainability](https://api.codeclimate.com/v1/badges/c8cd0a0f104820adc2ba/maintainability)](https://codeclimate.com/github/private-dreamnet/dreampower/maintainability)

# DreamPower

DreamPower allows you to use the power of your CPU or GPU to apply to photos a deep learning algorithm capable of predicting what a person's body would look like without clothes.
DreamPower is a deep learning algorithm based on [DeepNude](https://github.com/stacklikemind/deepnude_official) with the ability to predict what a naked person's body looks like.

DreamPower is a CLI application, if you don't have command line knowledge please use [DreamTime](https://time.dreamnet.tech) for a friendly user interface.
DreamPower is a CLI application, if you are looking for a **friendly way** to use DreamPower, please use the user interface: [DreamTime](https://time.dreamnet.tech).

# Differences with DeepNude
![](assets/preview.png)

DreamPower is a [fork](https://en.wikipedia.org/wiki/Fork_(software_development)) of [deepnude_official](https://github.com/stacklikemind/deepnude_official) and therefore it relies on the source code of the original program to process the photos.
## Differences with DeepNude

DreamPower stands out from DeepNude for having the following features:
DreamPower is a fork of [deepnude_official](https://github.com/stacklikemind/deepnude_official) but with constant improvements from the developers of DreamNet and the world, we stand out for offering these features:

- Processing with GPU (Transformation in seconds!)
- GPU Processing (Transformation in ~10 seconds!)
- Multiple GPU support
- Multithreading
- Auto-resize, auto-rescale, etc
- Support to transform animated GIFs
- Customization: size of boobs, pubic hair, etc.
- Constant updates!

> Most of these improvements are possible thanks to the community.
## DreamNet

# Community
Join the DreamNet social networks, the community interested in developing this technology. You can also join just to talk and make friends:

Join the social networks of DreamNet, the community interested in developing this technology in a more serious and real way. You can also join just to talk about the project, make friends or get help:
[![Keybase](https://img.shields.io/badge/keybase-33A0FF?logo=keybase&logoColor=white&style=for-the-badge)](https://keybase.io/team/dreamnet)
[![Twitter](https://img.shields.io/twitter/follow/DreamNetCom?label=twitter&logo=twitter&logoColor=white&style=for-the-badge&labelColor=1DA1F2)](https://twitter.com/DreamNetCom)
[![Facebook](https://img.shields.io/badge/facebook-4172B8?logo=facebook&logoColor=white&style=for-the-badge)](https://web.facebook.com/groups/812542509140670)

- [Keybase](https://keybase.io/team/dreamnet)
[![GitHub followers](https://img.shields.io/github/followers/private-dreamnet?label=github&logo=github&logoColor=white&style=for-the-badge&labelColor=181717)](https://github.com/private-dreamnet) [![DreamNet](https://img.shields.io/badge/dreamnet-E24329?logo=git&logoColor=white&style=for-the-badge)](https://git.dreamnet.tech/dreamnet)
[![NotABug](https://img.shields.io/badge/notabug-black?logo=git&logoColor=white&style=for-the-badge)](https://notabug.org/DreamNet)
[![GitGud](https://img.shields.io/badge/gitgud-F05032?logo=git&logoColor=white&style=for-the-badge)](https://gitgud.io/dreamnet)

# Support
## Support

Developing DreamNet applications is time consuming! Help us accelerate development and offer better updates!

[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/R6R2ZSG3)
[![Ko-fi](https://img.shields.io/badge/support%20with%20coffe-ff5e5b?logo=ko-fi&logoColor=white&style=for-the-badge)](https://ko-fi.com/R6R2ZSG3)

[![patreon](https://c5.patreon.com/external/logo/become_a_patron_button.png)](https://www.patreon.com/deepmanyy)
[![patreon](https://img.shields.io/badge/become%20a%20patron-fb6c54?logo=patreon&logoColor=white&style=for-the-badge)](https://www.patreon.com/deepmanyy)

# License
## Source Code

See **LICENSE.md** for more details.
This technology was going to arrive sooner or later and we want to keep it open and free for everyone. Help us in our goal of developing more applications with this technology.

---
[![GitHub stars](https://img.shields.io/github/stars/private-dreamnet/dreampower?logo=github&style=for-the-badge&labelColor=181717&label=Github)](https://github.com/private-dreamnet/dreampower)

[![DreamNet](https://img.shields.io/badge/dreamnet-E24329?logo=git&logoColor=white&style=for-the-badge)](https://git.dreamnet.tech/dreamnet/dreampower)

[![NotABug](https://img.shields.io/badge/notabug-black?logo=git&logoColor=white&style=for-the-badge)](https://notabug.org/DreamNet/dreampower)

# Installation
## Using Binaries Releases
[![GitGud](https://img.shields.io/badge/gitgud-F05032?logo=git&logoColor=white&style=for-the-badge)](https://gitgud.io/dreamnet/dreampower)

### Download
If you want to share or modify this software please do it for the same purpose as we do and always release the source code of your modifications. Read the [LICENSE](LICENSE) for more information.

Download DreamPower is very easy!
# 💜 Binaries

- [DreamPower](https://bit.ly/2KdqlYH): The command line interface (CLI), here you will find everything you need, just download the .zip file that fits your operating system.
## Requirements

- 64 bits OS
- Windows 7 SP1/Windows 8/Windows 10 1803+
- Ubuntu 16.04+
- macOS
- **8 GB** of RAM or more.

> ⚠ **N versions of Windows 10** require installing the [Media Feature Pack](https://www.microsoft.com/en-us/software-download/mediafeaturepack).

## GPU Processing Requirements

- NVIDIA Graphics card with minimum [3.5 CUDA compute capability](https://developer.nvidia.com/cuda-gpus)
- [Latest NVIDIA drivers](https://www.nvidia.com/Download/index.aspx)

### Download Mirrors
> 👉 If you do not have an NVIDIA or compatible graphics card you can use CPU processing.

- [DreamPower (MEGA)](https://bit.ly/2GD6aST)
- [DreamPower (MediaFire)](https://bit.ly/2LNjAQk)
## Download

### Setup

[![GitHub All Releases](https://img.shields.io/github/downloads/private-dreamnet/dreampower/total?logo=github&logoColor=white&style=for-the-badge&labelColor=181717&color=blue)](https://github.com/private-dreamnet/dreampower/releases)

## Installation

- Create a folder on your computer, it can be anywhere you want it, call it `DreamPower` and inside it place the zip file you have downloaded.
- Extract the file that contains the CLI, this should generate a folder called `dreampower`
@@ -63,39 +97,32 @@ Download DreamPower is very easy!
## Using package manager

### Archlinux (AUR)
For Archlinux, DreamPower is available on the [Archlinux User Repository](https://aur.archlinux.org/) in two version:

Available on the [Archlinux User Repository](https://aur.archlinux.org/) in two version:
* [dreampower](https://aur.archlinux.org/packages/dreampower) with CUDA Support
* [dreampower-cpu](https://aur.archlinux.org/packages/dreampower-cpu) with no CUDA Support

# Usage
## Usage

In the command line terminal run:

```
dreampower --help
dreampower --help
```

This will print out help on the parameters the algorithm accepts.

> **The input image should be 512px * 512px in size** (parameters are provided to auto resize / scale your input).


# GPU Processing Requirements

> If you do not have an NVIDIA or compatible graphics card you can use CPU processing.

- NVIDIA Graphics card with CUDA compatibility
- [Latest NVIDIA drivers](https://www.nvidia.com/Download/index.aspx)
> **The input image should be 512px * 512px in size** (parameters are provided to auto resize/scale your input).

---

# Development > Area only for developers!
# 💻 Development > 🚧 Area only for developers!

> **If you are a developer:** Consider making a fork of the project and make PR of any improvement you can do, also join our server in [Keybase](https://keybase.io/team/dreamnet) where we have channels exclusively for development.

## Requirements

- [Python 3.5+](https://www.python.org/downloads/)
- [Python 3.6.2+](https://www.python.org/downloads/release/python-368/)

## Prerequisite

@@ -104,13 +131,11 @@ Before you can launch the main alogirthm script you'll need to install certain p
We've added a setup script for the supported OSes in the 'scripts' folder that will do this for you.

The following OSes are supported:

- Windows
- MacOS
- Ubuntu16
- Ubuntu
- Linux


## Launch the script

```
@@ -139,13 +164,13 @@ We overcome the problem using a *divide-et-impera* approach. Instead of relying

## Original problem:

![Dress To Nude](readmeimgs/dress_to_nude.jpg?raw=true "Dress To Nude")
![Dress To Nude](assets/dress_to_nude.jpg?raw=true "Dress To Nude")

## Divide-et-impera problem:

![Dress To Mask](readmeimgs/dress_to_mask.jpg?raw=true "Dress To Mask")
![Mask To MaskDet](readmeimgs/mask_to_maskdet.jpg?raw=true "Mask To MaskDet")
![MaskDeto To Nude](readmeimgs/maskdet_to_nude.jpg?raw=true "MaskDeto To Nude")
![Dress To Mask](assets/dress_to_mask.jpg?raw=true "Dress To Mask")
![Mask To MaskDet](assets/mask_to_maskdet.jpg?raw=true "Mask To MaskDet")
![MaskDeto To Nude](assets/maskdet_to_nude.jpg?raw=true "MaskDeto To Nude")

This approach makes the construction of the sub-datasets accessible and feasible. Web scrapers can download thousands of images from the web, dressed and nude, and through photoshop you can apply the appropriate masks and details to build the dataset that solve a particular sub problem. Working on stylized and abstract graphic fields the construction of these datasets becomes a mere problem of hours working on photoshop to mask photos and apply geometric elements. Although it is possible to use some automations, the creation of these datasets still require great and repetitive manual effort.

@@ -163,4 +188,4 @@ Considering these additional transformations, the phases of the algorithm are th
- **maskfin -> nude** [GAN]


![Transformations](readmeimgs/transformation.jpg?raw=true "Transformations")
![Transformations](assets/transformation.jpg?raw=true "Transformations")

BIN
assets/dreampower.png View File


readmeimgs/dress_to_mask.jpg → assets/dress_to_mask.jpg View File


readmeimgs/dress_to_nude.jpg → assets/dress_to_nude.jpg View File


readmeimgs/mask_to_maskdet.jpg → assets/mask_to_maskdet.jpg View File


readmeimgs/maskdet_to_nude.jpg → assets/maskdet_to_nude.jpg View File


BIN
assets/preview.png View File


readmeimgs/transformation.jpg → assets/transformation.jpg View File


+ 16
- 0
scripts/package.json View File

@@ -0,0 +1,16 @@
{
"name": "dreampower-scripts",
"version": "0.0.1",
"license": "GPL-3.0-only",
"private": true,
"devDependencies": {
"@octokit/rest": "^16.28.7",
"aws-sdk": "^2.517.0",
"deferred": "^0.7.11",
"jszip": "^3.2.2",
"lodash": "^4.17.15",
"mime-types": "^2.1.24",
"node-7z": "^1.1.1",
"tar": "^4.4.10"
}
}

+ 211
- 0
scripts/release.js View File

@@ -0,0 +1,211 @@
/*
* DreamTime | (C) 2019 by Ivan Bravo Bravo <ivan@dreamnet.tech>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License 3.0 as published by
* the Free Software Foundation.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

const Octokit = require('@octokit/rest')
const AWS = require('aws-sdk')
const mime = require('mime-types')
const _ = require('lodash')
const Deferred = require('deferred')
const fs = require('fs')
const path = require('path')
const Seven = require('node-7z')
const tar = require('tar')

const octokit = new Octokit({
auth: process.env.GITHUB_TOKEN
})

const S3Client = new AWS.S3({
accessKeyId: process.env.S3_ACCESS_KEY_ID,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
endpoint: 'https://sfo2.digitaloceanspaces.com'
})

function getOS() {
if (process.platform === 'win32') {
return 'windows'
}

if (process.platform === 'darwin') {
return 'macos'
}

return 'ubuntu'
}

function getExt() {
if (process.platform === 'win32') {
return '7z'
}

if (process.platform === 'darwin') {
return '7z'
}

return 'tar.gz'
}

const isTagRelease = _.startsWith(process.env.GITHUB_REF, 'refs/tags')

const tagName = isTagRelease
? process.env.GITHUB_REF.split('/')[2]
: _.truncate(process.env.GITHUB_SHA, { length: 7, omission: '' })

const version = tagName
const fileName = `DreamPower-${version}-${getOS()}-${
process.env.BUILD_DEVICE
}.${getExt()}`

const buildPath = path.resolve(__dirname, '../dist/dreampower')
const filePath = path.resolve(__dirname, '../', fileName)

console.log({
tagName,
fileName,
buildPath,
filePath
})

async function getGithubReleaseUrl() {
let response

try {
response = await octokit.repos.getReleaseByTag({
owner: 'private-dreamnet',
repo: 'dreampower',
tag: tagName
})
} catch (err) {
if (err.status !== 404) {
throw err
}

try {
response = await octokit.repos.createRelease({
owner: 'private-dreamnet',
repo: 'dreampower',
tag_name: tagName,
name: version,
prerelease: true,
draft: true
})
} catch (err) {
console.log(err)
throw err
}
}

return response.data.upload_url
}

function uploadToS3(filePath, fileName) {
const deferred = new Deferred()

S3Client.upload(
{
Bucket: 'dreamnet-cdn',
Key: `releases/dreampower/${tagName}/${fileName}`,
Body: fs.createReadStream(filePath)
},
(err, response) => {
if (err) {
deferred.reject(err)
return
}

deferred.resolve(response)
}
)

return deferred.promise
}

async function uploadToGithub(filePath, fileName) {
const stats = fs.statSync(filePath)
const url = await getGithubReleaseUrl()

const response = await octokit.repos.uploadReleaseAsset({
url,
headers: {
'content-length': stats.size,
'content-type': mime.lookup(filePath)
},
name: fileName,
file: fs.createReadStream(filePath)
})

return response
}

async function upload(filePath, fileName) {
let response

if (isTagRelease) {
console.log(`Uploading ${fileName} to Github...`)
response = await uploadToGithub(filePath, fileName)
console.log('Github say: ', response)
}

console.log(`Uploading ${fileName} to S3...`)
response = await uploadToS3(filePath, fileName)
console.log('S3 say:', response)
}

async function zip() {
process.chdir(buildPath)

if (getOS() === 'windows') {
const sevenAdd = () => {
const deferred = new Deferred()

const process = Seven.add(filePath, '*', {
recursive: true
})

process.on('error', (err) => {
deferred.reject(err)
})

process.on('end', (info) => {
console.log(info)
deferred.resolve()
})

return deferred.promise
}

await sevenAdd()
} else {
await tar.create(
{
gzip: true,
file: filePath
},
['./']
)
}
}

async function main() {
if (!fs.existsSync(buildPath)) {
throw Error('No build path!')
}

await zip()

if (fs.existsSync(filePath)) {
upload(filePath, fileName)
} else {
console.log('No release found!')
}
}

main()

Loading…
Cancel
Save