Skip to content

Commit

Permalink
Merge pull request #40 from Lucs1590/master
Browse files Browse the repository at this point in the history
Readme and CI/CD
  • Loading branch information
AlvaroCavalcante authored Oct 30, 2021
2 parents de0a625 + 26ec8a6 commit 8766e73
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 11 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
16 changes: 16 additions & 0 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Greetings

on: [pull_request, issues]

jobs:
greeting:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: 'Thanks for contributing this issue! We will be replying soon.'
pr-message: 'Thanks for contributing this PR! We will validade soon.'
Binary file modified images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 13 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,33 @@

Are you tired to label your images by hand to work with object detection? Have hundreds or thousands of images to label? Then this project will make your life easier, just create some annotations and let the machine do the rest for you!

## Requirements
## Contents
- [Requirements](#requirements)
- [How to run](#usage)
- [TensorFlow < 2.x](#minor)
- [TensorFlow >= 2.x](#greater)
- [Any trouble?](#trouble)


## Requirements <a id="requirements"></a>
- You will need to [clone the TensorFlow repository](https://github.com/tensorflow/models)
- Install the [dependencies](https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/tensorflow-1.14/install.html) for object detection

## How to run
## How to run <a id="usage"></a>
- Copy and paste the files **generate_xml.py** and **visualization_utils.py** into the **research/object_detection/utils** in the tensorflow repo.
- Change the xml path in generate_xml.py to put your own local path.
- Add the images you want to label into the images folder

### TensorFlow < 2.x
### TensorFlow < 2.x <a id="minor"></a>
- Add your pre-treined model (as a fronzen inference graph) and label map into the 'graphs' folder.
- Inside the auto_annotate folder run: **python3 scripts/detection_images.py**
### TensorFlow >= 2.x
### TensorFlow >= 2.x <a id="greater"></a>
- If you have TF 2.x, just run the following command:
```
python3 scripts/detection_img_tf2.py --saved_model /path-saved-model --labelmap /path-label-map.pbtxt --imgs /path-of-the-imgs
```

- If it runs correctly, you will see the inference results and the xml in your respective folders!

## Any trouble?
## Any trouble? <a id="trouble"></a>
If you have trouble or doubt check my [tutorial on medium](https://medium.com/@alvaroleandrocavalcante/auto-annotate-images-for-tensorflow-object-detection-19b59f31c4d9?sk=0a189a8af4874462c1977c6f6738d759). You can also open an issue and I'll hep you!
12 changes: 6 additions & 6 deletions scripts/visualization_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
matplotlib.use('Agg') # pylint: disable=multiple-statements


_TITLE_LEFT_MARGIN = 10
_TITLE_TOP_MARGIN = 10
STANDARD_COLORS = [
'AliceBlue', 'Chartreuse', 'Aqua', 'Aquamarine', 'Azure', 'Beige', 'Bisque',
'BlanchedAlmond', 'BlueViolet', 'BurlyWood', 'CadetBlue', 'AntiqueWhite',
Expand Down Expand Up @@ -821,7 +819,8 @@ def visualize_boxes_and_labels_on_image_array(
if not skip_labels:
if not agnostic_mode:
if classes[i] in six.viewkeys(category_index):
class_name.append(category_index[classes[i]]['name'])
class_name.append(
category_index[classes[i]]['name'])
new_xml = True
else:
class_name.append('N/A')
Expand Down Expand Up @@ -894,10 +893,11 @@ def visualize_boxes_and_labels_on_image_array(
color=color,
radius=line_thickness / 2,
use_normalized_coordinates=use_normalized_coordinates)

if new_xml != False:
xml = generate_xml.GenerateXml(array_position, im_width, im_height, class_name, file_name)
xml.gerenate_basic_structure()
xml = generate_xml.GenerateXml(
array_position, im_width, im_height, class_name, file_name)
xml.gerenate_basic_structure()

return image

Expand Down

0 comments on commit 8766e73

Please sign in to comment.