depthai-python icon indicating copy to clipboard operation
depthai-python copied to clipboard

documentation glitches in Hello world tutorial

Open piponazo opened this issue 2 years ago • 6 comments

Hi, I just started my journey playing with the OAK-D camera and I found some "glitches" in the hello world tutorial. I thought about proposing a Pull Request with corrections, but I do not know enough about the project yet to make proper corrections. Therefore, I just wanted to mention it here so that somebody else hopefully can take the feedback and improve the documentation page:

  1. In the dependencies section, the python version is specified for Ubuntu or Raspbian, but not for other platforms (Windows, OSX, etc).
  2. Starting from section Define a pipeline there are references to dai. But that object or alias is not defined before. I actually noticed that in the code repository with the examples, dai is not used anymore.

piponazo avatar Dec 08 '21 13:12 piponazo

Hi, I'm joining in and asking as well for clarification of the tutorial.

About 2.: dai is probably short for depthai, so I just wrote in my code: import depthai as dai and of course replaced 'depthai' with dai in two lines where it's still called that way.

But there are more:

  1. the following code line is probably just an example: detection_nn.setBlobPath("/path/to/mobilenet-ssd.blob")

But there is no info how to get the blob. I took a look at full code at github (https://github.com/luxonis/depthai-tutorials/blob/master/1-hello-world/hello_world.py) and there you have instead: detection_nn.setBlobPath(str(blobconverter.from_zoo(name='mobilenet-ssd', shaves=6)))

  1. But as I further inspected the whole .py at github, I've noticed that there the pipeline methods are called differently at several lines, e.g.: detection_nn = pipeline.createMobileNetDetectionNetwork() instead of this in the tutorial: detection_nn = pipeline.create(dai.node.NeuralNetwork)

Then I checked the tutorial history on github and saw that after there was a commit " update tutorials to latest API (#294) " on 21 June, there was a an another commit "Merge branch 'develop' into gen2_scripting" on 24 June that changed the way the pipeline methods were called, as already mentioned above.

Is the older version of the tutorial from 21 June really using an older API? Because I constantly get errors with the current version of the tutorial:

Traceback (most recent call last):
  File "c:\Users\mpv98\AIKIT\depthai-tutorials-practice\1-hello-world\hello_world.py", line 27, in <module>
    detection_nn.setConfidenceThreshold(0.5)
AttributeError: 'depthai.node.NeuralNetwork' object has no attribute 'setConfidenceThreshold'

Then I have commented out the line and got the next error:

Traceback (most recent call last):
  File "c:\Users\mpv98\AIKIT\depthai-tutorials-practice\1-hello-world\hello_world.py", line 62, in <module>
    detections = in_nn.detections
AttributeError: 'depthai.NNData' object has no attribute 'detections'

MihailV1989 avatar Dec 08 '21 22:12 MihailV1989

Thanks for the report and sorry for the trouble here. Asking the team on this (who are in Europe, so will be online in ~9 hours or so).

Luxonis-Brandon avatar Dec 08 '21 22:12 Luxonis-Brandon

Sorry about these inaccuracies, I am currently fixing them. @piponazo 1) Python required version is >=3.6. 2) it should be import depthai as dai @MihailV1989 3) We are using blobconverter to download converted model, and it returns Path to the model. 4) It's a bit of a quirk in our API - both styles are supported, so it's up to you which to use. WRT AttributeError: 'depthai.node.NeuralNetwork' object has no attribute 'setConfidenceThreshold' - Only MobileNetDetectionNetwork and YoloDetectionNetwork (and Spatial versions of these 2 nodes) have option to set confidence threshold - as model results are parsed on the device itself. So we have changed from NeuralNetwork node to MobileNetDetectionNetwork, and output of NeuralNetwork node is NNData (which doesn't have detections attribute, while for MobileNetDetectionNetwork it's ImgDetections, which does have detections attribute. Sorry again for all this confusion, fixing docs/tutorial now.

Erol444 avatar Dec 09 '21 00:12 Erol444

PR here: https://github.com/luxonis/depthai-python/pull/449

Erol444 avatar Dec 09 '21 00:12 Erol444

PR here: #449

So far so good. But then you forgot to change detection_nn = pipeline.create(depthai.node.NeuralNetwork) to detection_nn = pipeline.create(depthai.node.MobileNetDetectionNetwork) didn't you?

MihailV1989 avatar Dec 09 '21 10:12 MihailV1989

@MihailV1989 you are right, thanks for noticing!

Erol444 avatar Dec 09 '21 14:12 Erol444