Skip to content

Commit

Permalink
[NEW] v0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
boromir674 committed Dec 1, 2021
2 parents 3380981 + b6c70b9 commit c3d045a
Show file tree
Hide file tree
Showing 65 changed files with 1,322 additions and 726 deletions.
45 changes: 45 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,32 @@ jobs:
export NEURAL_STYLE_TRANSFER_RELEASE_VERSION=$(python scripts/parse_package_version.py)
tox -e deploy -vv
run-algorithm:
executor: ubuntu-1604-vm
environment:
NST_OUTPUT: /nst-output
IMAGE: boromir674/neural-style-transfer
IMAGE_1: /app/tests/data/canoe_water_w300-h225.jpg
IMAGE_2: /app/tests/data/blue-red_w300-h225.jpg
ITER: 100
steps:
- run:
name: Create a directory to store the generated images
command: sudo mkdir $NST_OUTPUT
- run:
name: Pull an image (using docker) where both code and a pretrained model are present
command: docker pull $IMAGE
- run:
name: Run a Neural Style Transfer Algorithm for 22 iterations (using the pretrained VGG Deep Neural Network)
command: docker run -it --rm -v $NST_OUTPUT:$NST_OUTPUT $IMAGE $IMAGE_1 $IMAGE_2 --iterations $ITER --location $NST_OUTPUT
- store_artifacts:
path: /nst-output
destination: nst-output
- persist_to_workspace:
root: /
paths:
- nst-output

integration-test:
executor: py38-docker-image
steps:
Expand Down Expand Up @@ -148,10 +174,12 @@ workflows:
version: 2
build_accept:
jobs:

- build_n_test:
filters:
tags:
only: /.*/ # runs for all branches and all tags

- send-coverage-to-codacy:
requires:
- build_n_test
Expand All @@ -164,13 +192,30 @@ workflows:
filters:
tags:
only: /.*/
- run-algorithm:
requires:
- build_n_test
filters:
branches:
only:
- regression-test
- inspect-previous-artifacts:
type: approval
requires:
- run-algorithm
filters:
branches:
only:
- regression-test

- visualize_dependency_graphs:
filters:
branches:
only:
- master
- dev
- release-staging

# - build-documentation:
# filters:
# branches:
Expand Down
48 changes: 48 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
*/__pycache__
htmlcov
__pycache__
*.pyc
*.pyo
*.pyd
.Python
env
pip-log.txt
pip-delete-this-directory.txt
.tox
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.log
.git
.mypy_cache
.pytest_cache
.hypothesis

node_modules
pretrained*
style-images
local/
output/
nst_output/
env/
env-dev/
dist/
build/
test-results/
dependency-graphs/
uml-diagrams
.circleci
.vscode
.bettercodehub.yml
.gitignore
.prospector.yml
.pylintrc

mypy.ini
package.json
package-lock.json
tox.ini
Dockerfile
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ build/
*output
uml-diagrams
dependency-graphs
coverage.xml
5 changes: 3 additions & 2 deletions .prospector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ pep257:
mypy:
run: false
options:
ignore-missing-imports: true
follow-imports: skip
ignore-missing-imports: false
follow-imports: normal


vulture:
run: false
16 changes: 13 additions & 3 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,9 @@ contextmanager-decorators=contextlib.contextmanager

# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=_transform|self\.objects|self\._observers
# expressions are accepted. Things coming from a metaclass or a dynamic attribute set.
# Can solve E1101: Class 'X' has no 'y' member (no-member)
generated-members=self\.objects|self\._observers|compute_gram|_content_image|_style_image|adapter_type|mapping

# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
Expand Down Expand Up @@ -349,13 +350,22 @@ function-naming-style=snake_case
#function-rgx=

# Good variable names which should always be accepted, separated by a comma.
# Can solve C0103: Variable name "x" doesn't conform to snake_case naming style (invalid-name)
good-names=i,
j,
k,
ex,
Run,
_,
T
T,
a_C,
a_G,
a_S,
n_H,
n_W,
n_C,GS,GG,J_style,J_content,J_style_layer,W,b,
Js,Jt,Jc,
im

# Good variable names regexes, separated by a comma. If names match any regex,
# they will always be accepted
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
0.6.1 (2021-12-01)
------------------

Changes
^^^^^^^

test
""""
- test algorithm & conditionally mock production pretrained model


documentation
"""""""""""""
- document how to use the docker image hosted on docker hub


ci
""
- run regression test on ci server
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM python:3.8-slim

WORKDIR /app

ADD imagenet-vgg-verydeep-19.mat.tar .


COPY requirements/dev.txt reqs.txt
RUN pip install -r reqs.txt

COPY . .

RUN pip install -e .

COPY tests tests

ENV AA_VGG_19 /app/pretrained_model_bundle/imagenet-vgg-verydeep-19.mat
ENTRYPOINT [ "neural-style-transfer" ]
23 changes: 11 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This Python package runs a Neural Style Tranfer algorithm on input `content` and
- | |docker| |image_size|

* - code quality
- |better_code_hub| |code_climate| |maintainability| |codacy| |scrutinizer|
- |better_code_hub| |codacy| |code_climate| |maintainability| |scrutinizer|



Expand Down Expand Up @@ -147,9 +147,12 @@ and the pretrained model are present. That way you can immediately start creatin

docker pull boromir674/neural-style-transfer

mkdir nst-output
export NST_OUTPUT=/home/$USER/nst-output

docker run -it --rm -v nst-output:/app/nst-output boromir674/neural-style-transfer
CONTENT=/path/to/content-image.jpg
STYLE=/path/to/style-image.jpg

docker run -it --rm -v $NST_OUTPUT:/nst-output boromir674/neural-style-transfer $STYLE $CONTENT --iteratins 200 --location /nst-output



Expand All @@ -161,7 +164,7 @@ and the pretrained model are present. That way you can immediately start creatin

.. |codecov| image:: https://codecov.io/gh/boromir674/neural-style-transfer/branch/master/graph/badge.svg?token=3POTVNU0L4
:alt: Codecov
:target: https://codecov.io/gh/boromir674/neural-style-transfer
:target: https://app.codecov.io/gh/boromir674/neural-style-transfer/branch/master



Expand All @@ -177,32 +180,28 @@ and the pretrained model are present. That way you can immediately start creatin
:alt: PyPI - Python Version
:target: https://pypi.org/project/artificial-artwork

.. |commits_since| image:: https://img.shields.io/github/commits-since/boromir674/neural-style-transfer/v0.6/master?color=blue&logo=Github
.. |commits_since| image:: https://img.shields.io/github/commits-since/boromir674/neural-style-transfer/v0.6.1/master?color=blue&logo=Github
:alt: GitHub commits since tagged version (branch)
:target: https://github.com/boromir674/neural-style-transfer/compare/v0.6..master
:target: https://github.com/boromir674/neural-style-transfer/compare/v0.6.1..master



.. |better_code_hub| image:: https://bettercodehub.com/edge/badge/boromir674/neural-style-transfer?branch=master
:alt: Better Code Hub
:target: https://bettercodehub.com/


.. |codacy| image:: https://app.codacy.com/project/badge/Grade/07b27ac547a94708aefc5e845d2b6d01
:alt: Codacy
:target: https://www.codacy.com/gh/boromir674/neural-style-transfer/dashboard?utm_source=github.com&utm_medium=referral&utm_content=boromir674/neural-style-transfer&utm_campaign=Badge_Grade


.. |code_climate| image:: https://api.codeclimate.com/v1/badges/2ea98633f88b75e87d1a/maintainability
:alt: Maintainability
:target: https://codeclimate.com/github/boromir674/neural-style-transfer/maintainability


.. |maintainability| image:: https://img.shields.io/codeclimate/tech-debt/boromir674/neural-style-transfer?logo=CodeClimate
:alt: Technical Debt
:target: https://codeclimate.com/github/boromir674/neural-style-transfer/maintainability


.. |scrutinizer| image:: https://img.shields.io/scrutinizer/quality/g/boromir674/neural-style-transfer/master?logo=scrutinizer-ci
:alt: Scrutinizer code quality
:target: https://scrutinizer-ci.com/g/boromir674/neural-style-transfer/?branch=master
Expand All @@ -213,9 +212,9 @@ and the pretrained model are present. That way you can immediately start creatin
:alt: PyPI Package latest release
:target: https://pypi.org/project/topic-modeling-toolkit

.. |python_versions| image:: https://img.shields.io/pypi/pyversions/topic-modeling-toolkit.svg
.. |python_versions| image:: https://img.shields.io/pypi/pyversions/artificial-artwork.svg
:alt: Supported versions
:target: https://pypi.org/project/topic-modeling-toolkit
:target: https://pypi.org/project/artificial-artwork/



Expand Down
6 changes: 5 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]
## Setuptools specific information
name = artificial_artwork
version = 0.6
version = 0.6.1
description = Create artificial artwork by transfering the appearance of one image (eg a famous painting) to another user-supplied image (eg your favourite photograph).
long_description = file: README.rst
long_description_content_type = text/x-rst
Expand All @@ -14,6 +14,7 @@ author_email = k.lampridis@hotmail.com
# represents the web home page of the project
url = https://github.com/boromir674/neural-style-transfer

download_url = https://github.com/boromir674/neural-style-transfer/archive/v0.6.1.tar.gz

## PyPi specific information
project_urls =
Expand Down Expand Up @@ -78,8 +79,11 @@ skip = .tox,venv,env,env-dev
default_section = THIRDPARTY
known_first_party = src,tests


[semantic_release]
version_variable = src/artificial_artwork/__version__.py:__version__
version_source=source


[check-manifest]
ignore =
Expand Down
1 change: 1 addition & 0 deletions src/artificial_artwork/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.6.1'
6 changes: 0 additions & 6 deletions src/artificial_artwork/algorithm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import attr

from .style_layer_selector import NSTLayersSelection


@attr.s
class NSTAlgorithm:
Expand All @@ -10,11 +8,7 @@ class NSTAlgorithm:

@attr.s
class AlogirthmParameters:
# TODO remove content and style images and output_path
# retain only algorithm parameters (variables governing how the algo will behave)
# from the algo input (runtime objects that are the INPUT to the algo)
content_image = attr.ib()
style_image = attr.ib()
style_layers = attr.ib(converter=NSTLayersSelection.from_tuples)
termination_condition = attr.ib()
output_path = attr.ib()
Loading

0 comments on commit c3d045a

Please sign in to comment.