Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Tests

on:
push:
branches: [master, main]
pull_request:
branches: [master, main]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install CPU-only PyTorch
run: |
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu

- name: Install package and test deps
run: |
pip install pytest
pip install -e . --no-build-isolation

- name: Run tests (CPU-safe, no external data required)
run: |
pytest tests/ -x -v \
--ignore=tests/test_archs \
--ignore=tests/test_models \
--ignore=tests/test_data \
--ignore=tests/test_losses
58 changes: 36 additions & 22 deletions .github/workflows/publish-pip.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,44 @@
name: PyPI Publish

on: push
on:
push:
tags:
- 'v*'

jobs:
build-n-publish:
build:
name: Build distribution
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags')

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install build tools
run: pip install build
- name: Build sdist and wheel
run: python -m build
- name: Store distribution packages
uses: actions/upload-artifact@v4
with:
python-version: 3.8
- name: Upgrade pip
run: pip install pip --upgrade
- name: Install PyTorch (cpu)
run: pip install torch==1.7.0+cpu torchvision==0.8.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build and install
run: rm -rf .eggs && pip install -e .
- name: Build for distribution
# remove bdist_wheel for pip installation with compiling cuda extensions
run: python setup.py sdist
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
name: python-package-distributions
path: dist/

publish-to-pypi:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/basicsr/
permissions:
id-token: write # OIDC trusted publishing
steps:
- name: Download distributions
uses: actions/download-artifact@v4
with:
password: ${{ secrets.PYPI_API_TOKEN }}
name: python-package-distributions
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
41 changes: 22 additions & 19 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
name: PyLint
name: Lint

on: [push, pull_request]

jobs:
build:

lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
python-version: ["3.11"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff codespell

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install codespell flake8 isort yapf
- name: Lint with ruff
run: |
ruff check basicsr/ options/ scripts/ tests/ inference/
ruff format --check basicsr/ options/ scripts/ tests/ inference/

- name: Lint
run: |
codespell
flake8 .
isort --check-only --diff basicsr/ options/ scripts/ tests/ inference/ setup.py
yapf -r -d basicsr/ options/ scripts/ tests/ inference/ setup.py
- name: Spell check
run: |
codespell \
--skip=".git,./docs/build,*.cfg,*.toml,*.md" \
--ignore-words-list="uper,ramdom,propgation,simuator"
48 changes: 19 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,31 @@
name: release
name: Release

on:
push:
tags:
- '*'
- 'v*'

jobs:
build:
permissions: write-all
name: Create Release
release:
name: Create GitHub Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref }}
release_name: BasicSR ${{ github.ref }} Release Note
draft: true
prerelease: false
generate_release_notes: true
body: |
🚀 See you again 😸
🚀Have a nice day 😸 and happy everyday 😃
🚀 Long time no see ☄️

✨ **Highlights**
✅ [Features] Support ...
## BasicSR ${{ github.ref_name }}

🐛 **Bug Fixes**
### Highlights
- See commits for full change list.

🌴 **Improvements**

📢📢📢

<p align="center">
<img src="https://raw.githubusercontent.com/XPixelGroup/BasicSR/master/assets/basicsr_xpixel_logo.png" height=150>
</p>
draft: true
prerelease: false
### Installation
```bash
pip install basicsr==${{ github.ref_name }}
```
51 changes: 16 additions & 35 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,46 +1,27 @@
repos:
# flake8
- repo: https://github.com/PyCQA/flake8
rev: 3.8.3
# ruff — fast linter + formatter (replaces flake8, yapf, isort)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4
hooks:
- id: flake8
args: ["--config=setup.cfg", "--ignore=W504, W503"]

# modify known_third_party
- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
hooks:
- id: seed-isort-config

# isort
- repo: https://github.com/timothycrosley/isort
rev: 5.2.2
hooks:
- id: isort

# yapf
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.30.0
hooks:
- id: yapf
- id: ruff
args: ["--fix"]
- id: ruff-format

# codespell
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
rev: v2.3.0
hooks:
- id: codespell
args: ["--skip=.git,./docs/build,*.cfg,*.toml", "--ignore-words-list=gool"]

# pre-commit-hooks
# pre-commit general hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v5.0.0
hooks:
- id: trailing-whitespace # Trim trailing whitespace
- id: check-yaml # Attempt to load all yaml files to verify syntax
- id: check-merge-conflict # Check for files that contain merge conflict strings
- id: double-quote-string-fixer # Replace double quoted strings with single quoted strings
- id: end-of-file-fixer # Make sure files end in a newline and only a newline
- id: requirements-txt-fixer # Sort entries in requirements.txt and remove incorrect entry for pkg-resources==0.0.0
- id: fix-encoding-pragma # Remove the coding pragma: # -*- coding: utf-8 -*-
args: ["--remove"]
- id: mixed-line-ending # Replace or check mixed line ending
- id: trailing-whitespace
- id: check-yaml
- id: check-merge-conflict
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: mixed-line-ending
args: ["--fix=lf"]
22 changes: 5 additions & 17 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,16 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
os: ubuntu-24.04
tools:
python: "3.8"
# You can also specify other tool versions:
# nodejs: "16"
# rust: "1.55"
# golang: "1.17"
python: "3.11"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
configuration: docs/conf.py

# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf

# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: docs/requirements.txt
install:
- requirements: docs/requirements.txt
28 changes: 23 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@

[![LICENSE](https://img.shields.io/github/license/xinntao/basicsr.svg)](https://github.com/xinntao/BasicSR/blob/master/LICENSE.txt)
[![PyPI](https://img.shields.io/pypi/v/basicsr)](https://pypi.org/project/basicsr/)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/xinntao/BasicSR.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/xinntao/BasicSR/context:python)
[![python lint](https://github.com/xinntao/BasicSR/actions/workflows/pylint.yml/badge.svg)](https://github.com/xinntao/BasicSR/blob/master/.github/workflows/pylint.yml)
[![Publish-pip](https://github.com/xinntao/BasicSR/actions/workflows/publish-pip.yml/badge.svg)](https://github.com/xinntao/BasicSR/blob/master/.github/workflows/publish-pip.yml)
[![gitee mirror](https://github.com/xinntao/BasicSR/actions/workflows/gitee-mirror.yml/badge.svg)](https://github.com/xinntao/BasicSR/blob/master/.github/workflows/gitee-mirror.yml)
[![Python](https://img.shields.io/pypi/pyversions/basicsr)](https://pypi.org/project/basicsr/)
[![Lint](https://github.com/xinntao/BasicSR/actions/workflows/pylint.yml/badge.svg)](https://github.com/xinntao/BasicSR/blob/master/.github/workflows/pylint.yml)
[![Publish](https://github.com/xinntao/BasicSR/actions/workflows/publish-pip.yml/badge.svg)](https://github.com/xinntao/BasicSR/blob/master/.github/workflows/publish-pip.yml)

</div>

Expand All @@ -28,6 +27,26 @@

---

## Installation

```bash
pip install basicsr
```

For development or CUDA extension builds:

```bash
git clone https://github.com/XPixelGroup/BasicSR
cd BasicSR
pip install -e ".[dev]"
# Optional: compile CUDA ops
BASICSR_EXT=True pip install -e .
```

> **Requirements**: Python ≥ 3.9, PyTorch ≥ 2.0

---

BasicSR (**Basic** **S**uper **R**estoration) is an open-source **image and video restoration** toolbox based on PyTorch, such as super-resolution, denoise, deblurring, JPEG artifacts removal, *etc*.<br>
BasicSR (**Basic** **S**uper **R**estoration) 是一个基于 PyTorch 的开源 图像视频复原工具箱, 比如 超分辨率, 去噪, 去模糊, 去 JPEG 压缩噪声等.

Expand Down Expand Up @@ -120,4 +139,3 @@ If you have any questions, please email `xintao.alpha@gmail.com`, `xintao.wang@o
<img src="https://user-images.githubusercontent.com/17445847/139572512-8e192aac-00fa-432b-ac8e-a33026b019df.png" height="300">
</p>

![visitors](https://visitor-badge.glitch.me/badge?page_id=XPixelGroup/BasicSR) (start from 2022-11-06)
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.2
1.4.3
Loading