Giter Site home page Giter Site logo

tersekmatija / lwcc Goto Github PK

View Code? Open in Web Editor NEW
49.0 1.0 5.0 4.85 MB

LWCC: A LightWeight Crowd Counting library for Python that includes several pretrained state-of-the-art models.

License: MIT License

Python 1.83% Jupyter Notebook 98.17%
pytorch deep-learning crowdcounting crowd-counting python lwcc density-map density-estimation machine-learning

lwcc's Issues

PermissionError during creating the folders for downloaded weights data

Hi,

when I first tried out the package, I got always following exception

Traceback (most recent call last):
  File "/usr/lib/python3.8/pathlib.py", line 1288, in mkdir
    self._accessor.mkdir(self, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/.lwcc/weights'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./crowd_counting.py", line 53, in <module>
    results = count(args.img_path)
  File "./crowd_counting.py", line 38, in count
    count, density = LWCC.get_count(
  File "/home/jmkrieger/.local/lib/python3.8/site-packages/lwcc/LWCC.py", line 65, in get_count
    model = load_model(model_name, model_weights)
  File "/home/jmkrieger/.local/lib/python3.8/site-packages/lwcc/LWCC.py", line 31, in load_model
    model = model.make_model(model_weights)
  File "/home/jmkrieger/.local/lib/python3.8/site-packages/lwcc/models/CSRNet.py", line 13, in make_model
    output = weights_check("CSRNet", model_weights)
  File "/home/jmkrieger/.local/lib/python3.8/site-packages/lwcc/util/functions.py", line 17, in weights_check
    Path("/.lwcc/weights").mkdir(parents=True, exist_ok=True)
  File "/usr/lib/python3.8/pathlib.py", line 1292, in mkdir
    self.parent.mkdir(parents=True, exist_ok=True)
  File "/usr/lib/python3.8/pathlib.py", line 1288, in mkdir
    self._accessor.mkdir(self, mode)
PermissionError: [Errno 13] Permission denied: '/.lwcc'

I traced the error and found that the function weights_check in lwcc/util/functions.py tried to create the folder designated for the downloaded weights in the root folder, and not the home directory.

I could easily fixed it for me by changing the function to

def weights_check(model_name, model_weights):
    home = str(Path.home())

    # create dir if does not exists
    Path(os.path.join(home, ".lwcc/weights")).mkdir(parents=True, exist_ok=True)

    # download weights if not available
    file_name = "{}_{}.pth".format(model_name, model_weights)
    url = build_url(file_name)
    output = os.path.join(home, ".lwcc/weights/", file_name)
    # [...]

Thank you for creating this package - it's quite mindblowing what today's neural networks can achieve!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.