cortictechnology / cep

CEP is a software platform designed for users that want to learn or rapidly prototype using standard A.I. components.
MIT License
167 stars 21 forks source link

Initialise camera throwing 500 internal server error #29

Closed ArshadIram closed 2 years ago

ArshadIram commented 2 years ago

Hello,

I am trying to complete the setup by retrieving the device information.

Actual Result: On front end the screen is showing the loading sign.

On Backend:

oot : PWD=/home/pi/Desktop/Cortic/cep/src/cait/cortic_webapp ; USER=root ; COMMAND=/usr/sbin/iwgetid Mar 16 12:18:01 raspberrypi sudo[26701]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0) Mar 16 12:18:01 raspberrypi sudo[26701]: pam_unix(sudo:session): session closed for user root Mar 16 12:18:01 raspberrypi bash[383]: ERROR:main:Exception on /getwifi [GET] Mar 16 12:18:01 raspberrypi bash[383]: Traceback (most recent call last): Mar 16 12:18:01 raspberrypi bash[383]: File "/usr/local/lib/python3.9/dist-packages/wifi/scan.py", line 38, in all Mar 16 12:18:01 raspberrypi bash[383]: iwlist_scan = subprocess.check_output(['/sbin/iwlist', interface, 'scan'], Mar 16 12:18:01 raspberrypi bash[383]: File "/usr/lib/python3.9/subprocess.py", line 424, in check_output Mar 16 12:18:01 raspberrypi bash[383]: return run(popenargs, stdout=PIPE, timeout=timeout, check=True, Mar 16 12:18:01 raspberrypi bash[383]: File "/usr/lib/python3.9/subprocess.py", line 528, in run Mar 16 12:18:01 raspberrypi bash[383]: raise CalledProcessError(retcode, process.args, Mar 16 12:18:01 raspberrypi bash[383]: subprocess.CalledProcessError: Command '['/sbin/iwlist', 'wlan0', 'scan']' returned non-zero exit status 255. Mar 16 12:18:01 raspberrypi bash[383]: During handling of the above exception, another exception occurred: Mar 16 12:18:01 raspberrypi bash[383]: Traceback (most recent call last): Mar 16 12:18:01 raspberrypi bash[383]: File "/usr/lib/python3/dist-packages/flask/app.py", line 2447, in wsgi_app Mar 16 12:18:01 raspberrypi bash[383]: response = self.full_dispatch_request() Mar 16 12:18:01 raspberrypi bash[383]: File "/usr/lib/python3/dist-packages/flask/app.py", line 1952, in full_dispatch_request Mar 16 12:18:01 raspberrypi bash[383]: rv = self.handle_user_exception(e) Mar 16 12:18:01 raspberrypi bash[383]: File "/usr/local/lib/python3.9/dist-packages/flask_cors/extension.py", line 165, in wrapped_function Mar 16 12:18:01 raspberrypi bash[383]: return cors_after_request(app.make_response(f(args, kwargs))) Mar 16 12:18:01 raspberrypi bash[383]: File "/usr/lib/python3/dist-packages/flask/app.py", line 1821, in handle_user_exception Mar 16 12:18:01 raspberrypi bash[383]: reraise(exc_type, exc_value, tb) Mar 16 12:18:01 raspberrypi bash[383]: File "/usr/lib/python3/dist-packages/flask/_compat.py", line 39, in reraise Mar 16 12:18:01 raspberrypi bash[383]: raise value Mar 16 12:18:01 raspberrypi bash[383]: File "/usr/lib/python3/dist-packages/flask/app.py", line 1950, in full_dispatch_request Mar 16 12:18:01 raspberrypi bash[383]: rv = self.dispatch_request() Mar 16 12:18:01 raspberrypi bash[383]: File "/usr/lib/python3/dist-packages/flask/app.py", line 1936, in dispatch_request Mar 16 12:18:01 raspberrypi bash[383]: return self.view_functions[rule.endpoint](req.view_args) Mar 16 12:18:01 raspberrypi bash[383]: File "/home/pi/Desktop/Cortic/cep/src/cait/cortic_webapp/main.py", line 180, in getwifi Mar 16 12:18:01 raspberrypi bash[383]: cells = list(Cell.all("wlan0")) Mar 16 12:18:01 raspberrypi bash[383]: File "/usr/local/lib/python3.9/dist-packages/wifi/scan.py", line 41, in all Mar 16 12:18:01 raspberrypi bash[383]: raise InterfaceError(e.output.strip()) Mar 16 12:18:01 raspberrypi bash[383]: wifi.exceptions.InterfaceError: b"wlan0 Interface doesn't support scanning : Device or resource busy" Mar 16 12:18:01 raspberrypi bash[383]: 172.19.96.157 - - [16/Mar/2022 12:18:01] "GET /getwifi HTTP/1.1" 500 - Mar 16 12:18:01 raspberrypi bash[383]: INFO:werkzeug:172.19.96.157 - - [16/Mar/2022 12:18:01] "GET /getwifi HTTP/1.1" 500 - Mar 16 12:18:01 raspberrypi bash[383]: 172.19.96.157 - - [16/Mar/2022 12:18:01] "GET /isconnected HTTP/1.1" 200 - Mar 16 12:18:01 raspberrypi bash[383]: INFO:werkzeug:172.19.96.157 - - [16/Mar/2022 12:18:01] "GET /isconnected HTTP/1.1" 200 - Mar 16 12:18:02 raspberrypi sudo[26710]: root : PWD=/home/pi/Desktop/Cortic/cep/src/cait/cortic_webapp ; USER=root ; COMMAND=/usr/sbin/iwgetid Mar 16 12:18:02 raspberrypi sudo[26710]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0) Mar 16 12:18:02 raspberrypi sudo[26710]: pam_unix(sudo:session): session closed for user root

Environment informaiton: Raspberrypi 4B OS: 32 bit

michaelhwn commented 2 years ago

Hi @ArshadIram, is this related to issue 28?

ArshadIram commented 2 years ago

yes

michaelhwn commented 2 years ago

Thanks for closing the issue. Please try to use the method I replied in issue 28 and see if that solves your problem.

ArshadIram commented 2 years ago

I apologise for closing this. This is a separate issue. I am facing this issue while CAIT setup.
20220316_121740

michaelhwn commented 2 years ago

I see, this issue is probably related to a bug that was fixed in the dev branch. Please try setting up again with the dev branch of CEP on a newly flashed Raspberry Pi OS. To check out the dev branch, please perform the following steps:

git clone https://github.com/cortictechnology/cep.git
cd cep
git checkout dev

Please check again if the above issue still happens after setting up with the dev branch.

ArshadIram commented 2 years ago

I flashed Pi OS and reinstalled everything. Issue is fixed however, we are getting delay in video. For example, when we are testing it with OKD-lite the video is lagging. Can you please look into it.

michaelhwn commented 2 years ago

Hi @ArshadIram, are you accessing CAIT in the Chromium browser directly on the Raspberry Pi? If so, the performance will not be as good as it can be since the Chromium browser is also competing for CPU resources. Please try accessing the CAIT interface in a Chrome browser on another computer that is connected to the same local network.

ArshadIram commented 2 years ago

HI, Thanks a lot and now its working very fine.

I would like to ask few other general questions

  1. can we do our own custom training of object detection(Yolo V5 or other algorithm )
  2. Can the custom Trained model can be deployed via Cloud (Aws / etc)
  3. How many Oak-D can be added to this CAIT (for example 4 oak-d - is it possible )
  4. Can we write code in PyCharm / Jupyter/ Vs-code instead of the Blocks
  5. I would like to add another Mindstorm Hub (i assume all the connection process are same)
  6. I would like to know if we can add Alexa Eco Devices for the speech interface in CAIT.
michaelhwn commented 2 years ago

Hi @ArshadIram, glad to know it is working for you now. Regarding your questions:

  1. Yes, you can train your model. But you will need to extend CURT (backend of CEP) and CAIT (frontend of CEP) to use your model with your block. You can refer to my answer in here for more information on how to do that.
  2. CEP does not support cloud-based model deployment.
  3. You can only use one OAK-D device in the CAIT visual programming interface. However, if you use the CURT programming interface, you can use as many OAK-D as you have in your local network. You can refer to this example on how to use multiple OAK-D devices.
  4. Yes, there are two ways you can write a Python program:
    1. You can use CAIT's Python programming interface to write Python program. You can convert any CAIT visual program into Python code using the "Generate Python code" button shown in this picture
    2. You can use CURT's Python programming interface to get more control on CEP's backend. We have provided some examples to show you how to use it.
  5. You can add more Lego Mindstorms Robot Inventor Hub into the "initialize control" block by dragging and dropping an additional "add hub" block.
  6. We do not support Alex Eco in CEP for speech recognition. However, you are welcome to implement this feature and submit a pull request to CEP.
Roopesh-Bharatwaj-K-R commented 2 years ago

Hi @michaelhwn Thank you ver much for addressing all of our questions. sure we ( @ArshadIram ) will try implementing speech Recognition. And will respond you back.

michaelhwn commented 2 years ago

You are welcome @ArshadIram. Please feel free to reach out to me if you have any other problems.

ArshadIram commented 2 years ago

@michaelhwn Many thanks to you for your time and for fixing the issues. It was a really quick response and fix.

ArshadIram commented 2 years ago

@michaelhwn We do not support Alex Eco in CEP for speech recognition. However, you are welcome to implement this feature and submit a pull request to CEP.

Regarding this, we (@Roopesh-Bharatwaj-K-R ) would like to know further details.

michaelhwn commented 2 years ago

Hi @ArshadIram, please refer to the guide in here for details on how to extend CEP and add your own functionalities. Instead of modifying the vision module, you will need to extend the voice module and add a new Alexa worker. I have not done anything related to Alexa, so I am not familiar with the Alexa integration procedure. But for extending CEP, you can get started by following the guide I mentioned.