Skip to content

Commit

Permalink
docs: tests documentation for YOLO and Tesseract operators (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
aatmanvaidya authored Jan 8, 2024
1 parent 1a3da78 commit 8eefb63
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
16 changes: 15 additions & 1 deletion docs/src/pages/operators/detect-objects.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,18 @@ model = YOLO('yolov8n-seg.pt')
result = model.predict('path/to/your/image', save=True, imgsz=1024, conf=0.5, project='sample_data', name='output')
```

the output image will be saved in `sample_data/output` folder, and the resulting image will be titled as `output.png`. This image will have bounding boxes with objects detected and will also show the segmented area.
The output image will be saved in `sample_data/output` folder, and the resulting image will be titled as `output.png`. This image will have bounding boxes with objects detected and will also show the segmented area.

## How to Run the Test

The operator and the test file can be found at `src/api/core/operators` folder in the codebase. The operator is named `detect_objects.py` and the test file is named `test_detect_objects.py`

To run the test, simply just run the test file
```
python test_detect_objects.py
```

This will initiate the test and first the YOLO models `.pt` file will be downloaded, after the tests runs, you should get an `OK` message in the terminal indicating that the test has run successfully.

The output image will be saved in `sample_data/output` folder, and the resulting image will be titled as `output.png`. This image will have bounding boxes with objects detected and will also show the segmented area.

13 changes: 12 additions & 1 deletion docs/src/pages/operators/detect-text-in-image-tesseract.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,15 @@ data = pytesseract.image_to_string(image, lang='eng+hin', config='--psm 6 --oem

Here the config settings help us define some more insight into the image and LSTM blocks for the image extraction engines.

You can take a look at the operator and the test of the operator for the entire code.
You can take a look at the operator and the test of the operator for the entire code.

## How to Run the Test

The operator and the test file can be found at `src/api/core/operators` folder in the codebase. The operator is named `detect_text_in_image_tesseract.py` and the test file is named `test_detect_text_in_image_tesseract.py`

To run the test, simply just run the test file
```
python test_detect_text_in_image_tesseract.py
```

The test will check if text was extracted correctly or not, it will fetch an sample image from the `sample_data` folder. You should get an `OK` message in the terminal indicating that the test has run successfully.

0 comments on commit 8eefb63

Please sign in to comment.