pyronear / pyronear/pyro-envdev
[Python script] Improve fake alerts creation
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 1
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Current Behavior
- the directory images/
Two fake cameras have been created. The code is available in containers/dev_reolink and reolink_dev2. In both camera there is the following code which will download 4 images if the images/ directory doesn't exist:
# Get a list of image filenames in the directory
image_dir = "data/images"
images_name = [
"1465065360_-00240.jpg",
"1465065780_+00180.jpg",
"1465066800_+01200.jpg",
"1465068000_+02400.jpg",
]
url = "https://github.com/pyronear/pyro-devops/releases/download/v0.0.1/"
if not os.path.isfile(image_dir):
os.makedirs(image_dir, exist_ok=True)
for name in images_name:
print(f"Downloading images from {url + name} ...")
urlretrieve(url + name, image_dir + "/" + name)
Which means that both camera are using the same test images. When a GET call is done to @app.route("/cgi-bin/api.cgi") the images are sent back one after another.
- static vs PTZ
The configuration file of the camera is : data/credentials.json. You can see that reolink_dev is a static camera and reolink_dev2 is a ptz camera with two poses, which means that the camera can move between two poses in order to capture images from two different point of view
The only difference in the fake camera implementation is that the ptz camera has a second route @app.route("/cgi-bin/api.cgi", methods=["POST"]) which send automatically a 200. In real camera this route is used to move the camera between poses.
Wanted Behavior
-
Renaming the cameras
Instead of reolink_dev and directory dev_reolink it would be better to have something like test_camera_static and test_camera_ptz -
Not using the same images/ directory
Instead of checking if the directory exist we should create and commit three directories :
data/test_images_static/
data/test_images_ptz_pose1/
data/test_images_ptz_pose2/
In the python code, check that they are empty. If not, download the images as we already did. For the PTZ camera, each time the POST route is used, changed the directory used from _pose1 to _pose2.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the fake camera code in containers/dev_reolink and reolink_dev2, and inspect data/credentials.json plus the GET and POST /cgi-bin/api.cgi routes. Rename the cameras, add the three specified test-image directories, and verify that the PTZ POST route switches between pose directories while images are downloaded when a directory is empty.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100