Git Product home page Git Product logo

Comments (9)

nvtkaszpir avatar nvtkaszpir commented on June 12, 2024

can you rephrase your question please?
or explain what you have and what you want to do, and which subdirectory are you referring to?

from 3d-print.

cozmo14047 avatar cozmo14047 commented on June 12, 2024

Hi there sorry, i didint realise it was in just 3d printing direcory, for the obico one i see you say esp but nothing about raspberry pi. i just wanted to know if its compatable with a raspberry pi many thanks

from 3d-print.

nvtkaszpir avatar nvtkaszpir commented on June 12, 2024

You would have to expose rpi camera snapshot as static image over the web (there are many ways how to do it), that would be the best option.

Using camera device directly would require more code adjustments (using python picamera), but because it would require using camera directly via python it may interfere with other tools - so I'm not going to do it.

from 3d-print.

nvtkaszpir avatar nvtkaszpir commented on June 12, 2024

I think the easiest would be to run some process which would expose rpi camera as snapshot and then use that endpoint to fetch image.
Short search gives that https://github.com/signag/raspi-cam-srv should work with http://<server>:<port>/photo_feed

from 3d-print.

nvtkaszpir avatar nvtkaszpir commented on June 12, 2024

if you mean you want to use ml_api on the rpi and do detections on the image fetched directly from the camera, then no, right now this is not possible and it would require much more work:

  • add code to fetch image from camera using picamera python lib
  • compile code for rpi (arm and arm64 platfroms) which means fighting a lot fo dependencies
  • compute on rpi would be pretty slow and probably would take seconds to do a detection on full screen image.

For now this is just too much work so I'm not planning to do it.
Closing.

from 3d-print.

nvtkaszpir avatar nvtkaszpir commented on June 12, 2024

try https://github.com/nvtkaszpir/3d-print/tree/main/picamera-web as an endpoint exposing pi camera image over the web

from 3d-print.

cozmo14047 avatar cozmo14047 commented on June 12, 2024

Thank you. I didint think it would work with the pi thats why i asked

from 3d-print.

nvtkaszpir avatar nvtkaszpir commented on June 12, 2024

what I tested:

Running picamera-web on rpi and obico and scripts on another host

Testing it directly on rpi4 on 64bit Debian 12, where 192.168.1.50 is the IP address of the raspberry pi:

  • run all above on the rpi 4 - this way it would run obico and camera exposing service on the same device

  • it should work but will be slow

  • install docker and obico ml-api container (notice it fetches 3GB so it will take time)

     sudo docker run -it -p 3333:3333 quay.io/kaszpir/ml_api:812a05b7-arm64 gunicorn --bind 0.0.0.0:3333 --workers 1 wsgi --preload -e DARKNET_PATH=/darknet
  • in another terminal, fetch scripts and run picamera-web

     cd src
     git clone https://github.com/nvtkaszpir/3d-print.git
     cd 3d-print/picamera-web
     make web
  • in another terminal

     cd src/3d-print/obico-ml-api-only
     python3 draw_detections.py --api http://127.0.0.1:3333 http://192.168.1.50:8090/ --show
  • result:

     pi@hormex:~/src/3d-print/obico-ml-api-only $ Error: no "view" rule for type "image/png" passed its test case
            (for more information, add "--debug=1" on the command line)
     python3 draw_detections.py --api http://127.0.0.1:3333 http://192.168.1.50:8090/
     INFO:root:treshold=0.2
     INFO:root:api=http://127.0.0.1:3333
     INFO:root:ignore=[]
     INFO:root:show=False
     INFO:root:img_url=http://192.168.1.50:8090/
     INFO:root:saveimg=None
     INFO:root:savedet=None
     INFO:root:ignore_list: []
     DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 192.168.1.50:8090
     DEBUG:urllib3.connectionpool:http://192.168.1.50:8090 "GET / HTTP/1.1" 200 54196
     DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 127.0.0.1:3333
     DEBUG:urllib3.connectionpool:http://127.0.0.1:3333 "GET /p/?img=http%3A%2F%2F192.168.1.50%3A8090%2F&ignore=%5B%5D HTTP/1.1" 200 74
     INFO:root:detections: [["failure", 0.119, [326.0, 133.0, 264.0, 326.0]]]
     INFO:root:ignored: []
     
    

it detected failed area with confidence 0.119 (11.9%) - mainly because I have there some dummy spaghetti in front of camera :)

So it works but is slow.

from 3d-print.

nvtkaszpir avatar nvtkaszpir commented on June 12, 2024

also, obico-ml-api-only was not tested with video streams (I doudb it would work), so you would have to make a new service to expose single camera image from a stream so that obico ml api could fetch it and process it.
For such scenarios I suggest just using official obico.

from 3d-print.

Related Issues (1)

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.