Skip to content

Commit

Permalink
Setup Adjustment
Browse files Browse the repository at this point in the history
- Changed setup.py to use setuptools and wheel for setup
- renamed package from stc to vhh_stc and changed imports accordingly
- Extended README
  • Loading branch information
Jakob Büro committed Sep 30, 2020
1 parent 22c5552 commit 0460735
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Demo/vhh_stc_run_on_single_video.py
@@ -1,5 +1,5 @@

from stc.STC import STC
from vhh_stc.STC import STC
import numpy as np
import os

Expand Down
24 changes: 12 additions & 12 deletions README.md
Expand Up @@ -36,26 +36,26 @@ The following instructions have to be done to used this library in your own appl

**Install the stc package and all dependencies:**

* Update pip and setuptools (tested using pip\==20.2.3 and setuptools==50.3.0)
* Install the Wheel package: ```pip install wheel```
* change to the root directory of the repository (includes setup.py)
* python setup.py install
* ```python setup.py bdist_wheel```
* The aforementioned command should create a /dist directory containing a wheel. Install the package using ```python -m pip install dist/xxx.whl```

> **_NOTE:_**
You can check the success of the installation by using the commend *pip list*. This command should give you a list
with all installed python packages and it should include *vhh-stc*.

**Install PyTorch :**

Install a Version of PyTorch depending on your setup. Consult the [PyTorch website](https://pytorch.org/get-started/locally/) for detailed instructions.

**Setup environment variables:**

* source /data/dhelm/python_virtenv/vhh_sbd_env/bin/activate
* export CUDA_VISIBLE_DEVICES=1
* export PYTHONPATH=$PYTHONPATH:/XXX/vhh_stc/:/XXX/vhh_stc/Develop/:/XXX/vhh_stc/Demo/


> **_NOTE:_**
You can check the success of the installation by using the commend *pip list*. This command should give you a list
> with all installed python packages and it should include *vhh_stc*
>
> **_NOTE:_**
Currently there is an issue in the *setup.py* script. Therefore the pytorch libraries have to be installed manually
> by running the following command:
> *pip install torch==1.5.0+cu101 torchvision==0.6.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html*
**Run demo script**

* change to root directory of the repository
Expand Down
47 changes: 16 additions & 31 deletions setup.py
@@ -1,46 +1,31 @@
try: # for pip >= 10
from pip._internal.req import parse_requirements
from pip._internal.download import PipSession
except ImportError: # for pip <= 9.0.3
from pip.req import parse_requirements
from pip.download import PipSession
import logging
import os

try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from setuptools import setup, find_packages

with open("README.md", "r") as fh:
long_description = fh.read()

command = "";
try:
install_reqs = parse_requirements("requirements.txt", session=PipSession())
except Exception:
logging.warning('Fail load requirements file, so using default ones.')
install_reqs = []

# prepare pip command to install dependencies
tmp_str = "";
for requirement in install_reqs:
tmp_str = tmp_str + " " + str(requirement.req)
command = "pip install " + tmp_str + " "

# execute dependendcies
os.system(command)
print("all dependencies installed!")
# read requirements
install_requires=[]
with open("requirements.txt", "r") as f:
reqs = f.readlines()
for i in range(len(reqs)):
req = reqs[i]
if i < len(reqs)-1:
req = req[:-1]
if req[0] is not '#':
install_requires.append(req)

# install sbd package
# install vhh_sbd package
setup(
name='vhh_stc',
version='1.0.0',
author="Daniel Helm",
author_email="daniel.helm@tuwien.ac.at",
description="Shot Type Classification Package",
description="Shot Boundary Detection Package",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/dahe-cvl/vhh_stc",
packages=["stc"]
url="https://github.com/dahe-cvl/vhh_tc",
packages=find_packages(),
install_requires=install_requires
)
2 changes: 1 addition & 1 deletion stc/Configuration.py → vhh_stc/Configuration.py
@@ -1,4 +1,4 @@
from stc.utils import *
from vhh_stc.utils import *
import yaml


Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion stc/Datasets.py → vhh_stc/Datasets.py
Expand Up @@ -11,7 +11,7 @@
from torch.utils.data import DataLoader
from torchvision import models
import cv2
from stc.CustomTransforms import *
from vhh_stc.CustomTransforms import *


def loadDatasetFromFolder(path="", batch_size=64):
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions stc/STC.py → vhh_stc/STC.py
@@ -1,15 +1,15 @@
import numpy as np
from stc.Video import Video
from vhh_stc.Video import Video
import os
from stc.Models import loadModel
from stc.CustomTransforms import ToGrayScale
from vhh_stc.Models import loadModel
from vhh_stc.CustomTransforms import ToGrayScale
import torch
from PIL import Image
from torch.autograd import Variable
from torch.utils import data
from torchvision import transforms
from stc.utils import *
from stc.Configuration import Configuration
from vhh_stc.utils import *
from vhh_stc.Configuration import Configuration
import cv2
import json

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion stc/Video.py → vhh_stc/Video.py
@@ -1,7 +1,7 @@
import numpy as np
import cv2
import datetime
from stc.utils import *
from vhh_stc.utils import *
from PIL import Image


Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 0460735

Please sign in to comment.