Giter Club home page Giter Club logo

karolzak / cntk-python-web-service-on-azure Goto Github PK

View Code? Open in Web Editor NEW
26.0 8.0 18.0 542 KB

This sample project shows off how to prepare and deploy to Azure Web Apps a simple Python web service with an image classifying model produced in CNTK (Cognitive Toolkit) using FasterRCNN

License: MIT License

Python 97.87% Batchfile 2.13%
cntk python image-classification cntk-model flask fasterrcnn azure-web azure-web-app-service azure-webapp kudu

cntk-python-web-service-on-azure's People

Contributors

karolzak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cntk-python-web-service-on-azure's Issues

Web Server Deployment Issue

Thank you so much for creating such an awesome resource! :) I have followed along the instructions in this article, however, I am getting the following error upon committing:

remote: Running setup.py (path:D:\home\site\wwwroot\env\build\pandas\setup.py) egg_info for package pandas
remote: ........
remote: Traceback (most recent call last):
remote: File "", line 17, in
remote: File "D:\home\site\wwwroot\env\build\pandas\setup.py", line 696, in
remote: **setuptools_kwargs)
remote: File "D:\python27\Lib\distutils\core.py", line 111, in setup
remote: _setup_distribution = dist = klass(attrs)
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\dist.py", line 262, in init
remote: self.fetch_build_eggs(attrs['setup_requires'])
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\dist.py", line 287, in fetch_build_eggs
remote: replace_conflicting=True,
remote: File "D:\home\site\wwwroot\env\lib\site-packages\pkg_resources.py", line 614, in resolve
remote: dist = best[req.key] = env.best_match(req, ws, installer)
remote: File "D:\home\site\wwwroot\env\lib\site-packages\pkg_resources.py", line 857, in best_match
remote: return self.obtain(req, installer)
remote: File "D:\home\site\wwwroot\env\lib\site-packages\pkg_resources.py", line 869, in obtain
remote: return installer(requirement)
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\dist.py", line 338, in fetch_build_egg
remote: return cmd.easy_install(req)
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\command\easy_install.py", line 613, in easy_install
remote: return self.install_item(spec, dist.location, tmpdir, deps)
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\command\easy_install.py", line 643, in install_item
remote: dists = self.install_eggs(spec, download, tmpdir)
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\command\easy_install.py", line 833, in install_eggs
remote: return self.build_and_install(setup_script, setup_base)
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\command\easy_install.py", line 1055, in build_and_install
remote: self.run_setup(setup_script, setup_base, args)
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\command\easy_install.py", line 1040, in run_setup
remote: run_setup(setup_script, args)
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\sandbox.py", line 68, in run_setup
remote: DirectorySandbox(setup_dir).run(runner)
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\sandbox.py", line 114, in run
remote: return func()
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\sandbox.py", line 67, in runner
remote: _execfile(setup_script, ns)
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\sandbox.py", line 42, in _execfile
remote: code = compile(script, filename, 'exec')
remote: File "d:\local\temp\easy_install-bnpnub\numpy-1.19.0rc1\setup.py", line 182
remote: raise ValueError(f'Submodule {p} missing')
remote: ^
remote: SyntaxError: invalid syntax
remote: Complete output from command python setup.py egg_info:
remote: Traceback (most recent call last):
remote:
remote: File "", line 17, in
remote:
remote: File "D:\home\site\wwwroot\env\build\pandas\setup.py", line 696, in
remote:
remote: **setuptools_kwargs)
remote:
remote: File "D:\python27\Lib\distutils\core.py", line 111, in setup
remote:
remote: _setup_distribution = dist = klass(attrs)
remote:
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\dist.py", line 262, in init
remote:
remote: self.fetch_build_eggs(attrs['setup_requires'])
remote:
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\dist.py", line 287, in fetch_build_eggs
remote:
remote: replace_conflicting=True,
remote:
remote: File "D:\home\site\wwwroot\env\lib\site-packages\pkg_resources.py", line 614, in resolve
remote:
remote: dist = best[req.key] = env.best_match(req, ws, installer)
remote:
remote: File "D:\home\site\wwwroot\env\lib\site-packages\pkg_resources.py", line 857, in best_match
remote:
remote: return self.obtain(req, installer)
remote:
remote: File "D:\home\site\wwwroot\env\lib\site-packages\pkg_resources.py", line 869, in obtain
remote:
remote: return installer(requirement)
remote:
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\dist.py", line 338, in fetch_build_egg
remote:
remote: return cmd.easy_install(req)
remote:
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\command\easy_install.py", line 613, in easy_install
remote:
remote: return self.install_item(spec, dist.location, tmpdir, deps)
remote:
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\command\easy_install.py", line 643, in install_item
remote:
remote: dists = self.install_eggs(spec, download, tmpdir)
remote:
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\command\easy_install.py", line 833, in install_eggs
remote:
remote: return self.build_and_install(setup_script, setup_base)
remote:
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\command\easy_install.py", line 1055, in build_and_install
remote:
remote: self.run_setup(setup_script, setup_base, args)
remote:
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\command\easy_install.py", line 1040, in run_setup
remote:
remote: run_setup(setup_script, args)
remote:
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\sandbox.py", line 68, in run_setup
remote:
remote: DirectorySandbox(setup_dir).run(runner)
remote:
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\sandbox.py", line 114, in run
remote:
remote: return func()
remote:
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\sandbox.py", line 67, in runner
remote:
remote: _execfile(setup_script, ns)
remote:
remote: File "D:\home\site\wwwroot\env\lib\site-packages\setuptools\sandbox.py", line 42, in _execfile
remote:
remote: code = compile(script, filename, 'exec')
remote:
remote: File "d:\local\temp\easy_install-bnpnub\numpy-1.19.0rc1\setup.py", line 182
remote:
remote: raise ValueError(f'Submodule {p} missing')
remote:
remote: ^
remote:
remote: SyntaxError: invalid syntax
remote:
remote: ----------------------------------------
remote: Cleaning up...
remote: ....
remote: Command python setup.py egg_info failed with error code 1 in D:\home\site\wwwroot\env\build\pandas
remote: Storing debug log for failure in D:\home\pip\pip.log
remote: An error has occurred during web site deployment.
remote:
remote: Error - Changes committed to remote repository but deployment to website failed.

Any help would be greatly appreciated!

TypeError: 'NoneType' object is not callable

Hello,

I've followed the instructions for deploying the web app and I've ran into an issue. When I make a post request I get Error 500. I find the following error in logs

[2018-11-22 00:37:37,345] ERROR in app: Exception on /hotelidentifier/api/v1.0/evaluate/returntags [POST]
Traceback (most recent call last):
  File "D:\home\python354x64\lib\site-packages\flask\app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "D:\home\python354x64\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "D:\home\python354x64\lib\site-packages\flask\app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "D:\home\python354x64\lib\site-packages\flask\_compat.py", line 33, in reraise
    raise value
  File "D:\home\python354x64\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "D:\home\python354x64\lib\site-packages\flask\app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "D:\home\site\wwwroot\app.py", line 41, in return_tags
    return jsonify(tags=[e.serialize() for e in evaluateimage(temp_file_path,"returntags",eval_model=loadedModel)])
  File "D:\home\site\wwwroot\evaluate.py", line 176, in evaluateimage
    bgrPlotThreshold=cfg["CNTK"].RESULTS_BGR_PLOT_THRESHOLD)
  File "D:\home\site\wwwroot\evaluate.py", line 87, in eval_faster_rcnn
    frcn_eval = eval_model(image_input, dims_input)
TypeError: 'NoneType' object is not callable

I'm not sure exactly what's wrong. Any help would be appreciated

Where are the dataset files

Hi
I have simulated object detection on my machine using fasterRcnn now I want to expose it to webservice in Azure. So I was following your github repo. I want to know what the purpose of .temp folder used by the webservice. I specifically want to know which folder are you storing the positive/negative and test images.
generally its set up in the config.py file as __C.CNTK.MAP_FILE_PATH = parameter, its missing in the config.py file for this git repo. Is there a script to download the data set too. I noticed you have it in another git repo for detection. But why not in this. This one only downloads the model and classfiles from blob but no data files. Thanks in advance for help.

opencv-webapp-on-azure

Hello,
I'm new with Azure webapps and i'm trying to create a webservice that uses OpenCV libraries in Python and prints out some results.
So far, I have the webapp created, and in my folder I have the file: application.py which only returns the string "hello" and imports the packages, the file: requirements.txt which installs Numpy, Keras, Opencv-python, etc correctly, and the folder of the environment /env.
Everything works fine if in the application.py I import other python files, and flask, pandas, numpy, etc but not when I write import cv2.
Also, I've tried to run it locally and it runs correctly.
Have I missed any step when installing OpenCV?
Thanks for your help

Issue with font on Linux

If you get an error with font on Linux while trying to POST an image, you need to edit the file
CNTK-Python-Web-Service-on-Azure/plot_helpers.py, edit the lines 318, 323 and change:
ImageFont.truetype("arial.ttf", 16)):
to
ImageFont.truetype(available_font, 16)):
as it has been done by @karolzak in:
fixed an issue with font on Linux

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.