Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
f25ac18
Add kp_module
anivegesana Feb 3, 2021
8d27225
Some bug fixes
anivegesana Feb 3, 2021
d30d4b0
Doesn't crash anymore
anivegesana Feb 3, 2021
ab739f7
Some very basic documentation
anivegesana Feb 3, 2021
831956c
backbone and hourglass, TODO: pre-heatmap layers
davidliii Feb 4, 2021
e7905b5
Reorganize code
anivegesana Feb 4, 2021
889c8a6
Remove order parameter and infer it from the filter sizes
anivegesana Feb 4, 2021
b31f2c7
Add gaussian penalty function
jacklecroy Feb 4, 2021
b46871c
finished backbone, adding documentation+tests
davidliii Feb 6, 2021
4a30485
Use regular Conv2D
anivegesana Feb 8, 2021
c73c740
Copy losses from ODAPI
anivegesana Feb 8, 2021
a00fd78
cleaned and updated tests
davidliii Feb 8, 2021
b33d386
added gaussian utils
Feb 8, 2021
48d652c
built basic config loader, adapted tests
davidliii Feb 8, 2021
1cbfc42
add parser centernet
jacklecroy Feb 10, 2021
19f6b4c
Add test cases
anivegesana Feb 10, 2021
49d5e80
Bug fix
anivegesana Feb 11, 2021
fd1102a
Restructured backbone
anivegesana Feb 11, 2021
b2314ee
Remove old backbone implementation
anivegesana Feb 11, 2021
c6a23e0
Bug fixes
anivegesana Feb 11, 2021
ef6cf21
Some changes to the Hourglass configs
anivegesana Feb 11, 2021
c5a86f1
Merge pull request #21 from PurdueCAM2Project/centernet-backbone
anivegesana Feb 11, 2021
b85dbdd
I am dumb. You are right David. We need the YOLO ConvBN.
davidliii Feb 14, 2021
6fbef32
wrote head and conv nn_block + tests (adding more)
davidliii Feb 14, 2021
5415f9a
Add test cases for gaussian_radius
anivegesana Feb 14, 2021
037e78c
Add base code for OD task
anivegesana Feb 14, 2021
fd4eaed
loss_utils.py for helper functions
patel996 Feb 14, 2021
1a7cae1
Create tensors
jacklecroy Feb 15, 2021
17fd954
Correct bug in Gaussian ground truth
anivegesana Feb 15, 2021
9e5ff89
bias initialization + more tests
davidliii Feb 16, 2021
c74e2df
implement penalty reduced local loss
patel996 Feb 16, 2021
761d65e
moved code to decoder directory
davidliii Feb 16, 2021
c78fe9c
added config
davidliii Feb 16, 2021
64e73f4
implement l1 localization loss
patel996 Feb 16, 2021
9882cf9
New config format
anivegesana Feb 16, 2021
bed46cf
updated build and test for new cfg format
davidliii Feb 17, 2021
1bb1ce3
More accurate hyperparameter naming
anivegesana Feb 17, 2021
4cde891
Merge branch 'centernet-backbone' into centernet-head
anivegesana Feb 17, 2021
61ea48b
Merge pull request #22 from PurdueCAM2Project/centernet-head
anivegesana Feb 17, 2021
5c14562
Merge remote-tracking branch 'origin/centernet-oap' into centernet-loss
anivegesana Feb 17, 2021
8ce9cba
Add build_model function and change some basic formatting
anivegesana Feb 17, 2021
c18a0c3
Adapt TF1 version of absolute_difference to TF2
anivegesana Feb 19, 2021
e3ec215
finished build_model, passes base tests
davidliii Feb 23, 2021
980db00
Merge branch 'centernet-task' of https://github.com/PurdueCAM2Project…
davidliii Feb 23, 2021
d789b16
moved CenterNet_test out of layers directory
davidliii Feb 24, 2021
2521ec7
Another test case
anivegesana Feb 24, 2021
f77b23c
update comments
patel996 Feb 25, 2021
b1d916d
update
patel996 Feb 25, 2021
6c628f1
Add log2 and log3
anivegesana Feb 25, 2021
ac14285
Temporary fix to different calling conventions in ODAPI loss and Kera…
anivegesana Feb 25, 2021
4182d55
More closely follow TFVision conventions
anivegesana Feb 25, 2021
c38bc40
get_config in penalty_reduced_logistic_focal_loss
anivegesana Feb 25, 2021
6011df2
Start using tf.Variable
anivegesana Feb 25, 2021
8a96c70
merge
patel996 Feb 25, 2021
6e796a3
Remove variable
anivegesana Feb 25, 2021
ab247a4
restructured decoder to functional style
davidliii Feb 25, 2021
da94c3e
updated centernet task test
davidliii Feb 25, 2021
e5d7d87
Test object detection losses
patel996 Feb 26, 2021
25721d5
mine
Feb 26, 2021
ac5fd96
Merge branch 'centernet-groundtruth' of github.com:PurdueCAM2Project/…
Feb 26, 2021
9538924
Visually show heatmaps
anivegesana Mar 1, 2021
8e52e3a
added build_inputs template and fixed centernet parser
Mar 1, 2021
7b845bb
fixed tests for merge
davidliii Mar 1, 2021
a79bc4d
update utils with more functions
patel996 Mar 5, 2021
07ae782
weightloading + minor changes to model components
davidliii Mar 5, 2021
c4af966
documented + number weights tracking
davidliii Mar 8, 2021
b6a421e
fixed up some tests
davidliii Mar 8, 2021
70a592b
Merge pull request #26 from PurdueCAM2Project/centernet-loss
anivegesana Mar 8, 2021
57772cb
Merge pull request #25 from PurdueCAM2Project/centernet-task
anivegesana Mar 8, 2021
1e4e7fd
Merge branch 'centernet-groundtruth' into centernet-oap
anivegesana Mar 8, 2021
51fdb14
Rename inputs to match loss names
anivegesana Mar 9, 2021
d651321
loss testing
patel996 Mar 10, 2021
eb27a30
Merge branch 'centernet-oap' into centernet-loss
patel996 Mar 10, 2021
ec92840
fix the filename
patel996 Mar 10, 2021
8653eb9
remove test from main
patel996 Mar 10, 2021
e44befd
detection generator
davidliii Mar 10, 2021
96bcd9e
need to merge from yolo_debug
davidliii Mar 10, 2021
9123f20
Merge branch 'yolo_debug' into centernet-task
davidliii Mar 10, 2021
a51226d
Merge branch 'centernet-oap' into centernet-loss
anivegesana Mar 11, 2021
e991c3f
Merge pull request #28 from PurdueCAM2Project/centernet-loss
anivegesana Mar 11, 2021
ce61a7c
demo working, adding docs later
davidliii Mar 11, 2021
40e5cf8
detection generator finished
davidliii Mar 12, 2021
6dedb04
comment fix
davidliii Mar 12, 2021
b5e5b3a
moved groundtruth to preprocessing ops
Mar 15, 2021
efefbe7
Factorize out heatmap function
anivegesana Mar 17, 2021
dd2c0be
Merge branch 'centernet-oap' into centernet-groundtruth-tfvar
anivegesana Mar 17, 2021
b7b4c08
Code to show heatmaps again
anivegesana Mar 17, 2021
230df85
Merge branch 'centernet-groundtruth-tfvar' into centernet-dataaug
anivegesana Mar 17, 2021
148d2f4
add input test
Mar 17, 2021
c0c64be
add input test
Mar 17, 2021
ec9242a
added batch sizes to centernet
Mar 20, 2021
c10e55d
Get it to run again
anivegesana Mar 20, 2021
d138373
Parallel Gaussian penalty
anivegesana Mar 20, 2021
4bf47ca
Make code ugly to make it work better in TF
anivegesana Mar 21, 2021
8b9627c
Remove batches
anivegesana Mar 23, 2021
72248ea
working on testing validation
davidliii Mar 29, 2021
7f1168b
Merge branch 'centernet-dataaug' into centernet-task
davidliii Mar 29, 2021
b24f932
build inputs
davidliii Apr 1, 2021
58370a0
yaml, task, and model changes
davidliii Apr 5, 2021
4665a16
still working through errors when running train
davidliii Apr 5, 2021
9d18970
getting to eval step, but errors in build_losses
davidliii Apr 7, 2021
1b6bc89
task uses parser config params
davidliii Apr 7, 2021
8a1ab85
added box indices and masks to build_label
davidliii Apr 9, 2021
424959a
new loss and ground truth
davidliii Apr 9, 2021
24ed6eb
build_metrics
Apr 10, 2021
7677482
eval running, can try on vm
davidliii Apr 12, 2021
0d106ff
Merge branch 'centernet-task' of https://github.com/PurdueCAM2Project…
davidliii Apr 12, 2021
f6f40f2
testing on vm
davidliii Apr 12, 2021
3e487f6
Merge branch 'centernet-task' of https://github.com/PurdueCAM2Project…
davidliii Apr 12, 2021
696c971
dataloader
davidliii Apr 12, 2021
ec7fdda
train step
davidliii Apr 12, 2021
462db56
tpu config
davidliii Apr 13, 2021
1281546
tpu experiment config
davidliii Apr 13, 2021
46ad107
tpu stuff
davidliii Apr 13, 2021
c7098d0
getting cannot build error
davidliii Apr 13, 2021
24e516a
testing
davidliii Apr 14, 2021
25afe15
casting in det gen
davidliii Apr 14, 2021
fe48982
added cast option to config
davidliii Apr 14, 2021
d0ca63e
fix model build on tpu
davidliii Apr 15, 2021
4b2fb2d
model build & inputs on TPU
davidliii Apr 16, 2021
09c9d05
testing
davidliii Apr 16, 2021
f0b2d0c
removed loops from gt builder, need to test speed
davidliii Apr 18, 2021
ee8c96d
new hm builder ~8x faster on GPU, todo test on TPU
davidliii Apr 18, 2021
9135403
added documentation, also is now 16x faster
davidliii Apr 18, 2021
529b792
testing on tpu
davidliii Apr 19, 2021
e7f4f77
dataset iterator test
davidliii Apr 19, 2021
a5f016d
class offset, checking if parser outputs are valid
davidliii Apr 19, 2021
b92ba42
works on tpu
davidliii Apr 19, 2021
1ba96ba
fixed box widths
davidliii Apr 19, 2021
d7d88bb
Merge branch 'centernet-task' of https://github.com/PurdueCAM2Project…
davidliii Apr 19, 2021
0021a43
getting stuck in standard_runner loop
davidliii Apr 20, 2021
716b4ec
log statements
davidliii Apr 20, 2021
bf95680
removed old ground truth builder
davidliii Apr 20, 2021
9f0f747
Merge branch 'centernet-task' of https://github.com/PurdueCAM2Project…
davidliii Apr 20, 2021
28923c9
killed?
davidliii Apr 20, 2021
ef87694
got rid of logging statements
davidliii Apr 20, 2021
10dc0fd
try getting rid of corner labels
davidliii Apr 21, 2021
aa1d19a
trying moving gt builder to loss
davidliii Apr 21, 2021
2a3439e
using gt builder in loss
davidliii Apr 21, 2021
b461e36
config update
davidliii Apr 21, 2021
70215ac
eval runs now, debugging detgen
davidliii Apr 21, 2021
21dc2c1
issue likely not in det generator
davidliii Apr 26, 2021
8f69cd2
tested odapi conv block padding
davidliii Apr 26, 2021
0cea19c
moved box normalization params to config
davidliii Apr 26, 2021
58d736f
new residual block for centernet, ready to eval
davidliii Apr 28, 2021
55a0393
config update
davidliii Apr 28, 2021
1d9a44d
backbone validation
davidliii Apr 28, 2021
2b8b90b
Merge branch 'centernet-task' of https://github.com/PurdueCAM2Project…
davidliii Apr 28, 2021
904f164
documentation + config cleanup
davidliii Apr 29, 2021
217903c
modeling documentation
davidliii Apr 30, 2021
c50c5eb
eval normalization
davidliii Apr 30, 2021
93e2a13
normalization to datapipline
davidliii Apr 30, 2021
dca114c
documentation, normalization in config
davidliii Apr 30, 2021
a586758
tested eval for new preprocessing on vm
davidliii Apr 30, 2021
516bd68
Create README.md
anivegesana May 12, 2021
a14b489
Create requirements.txt
anivegesana May 12, 2021
5650563
Merge pull request #35 from PurdueCAM2Project/centernet-task
anivegesana May 12, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"python.pythonPath": "/usr/bin/python3.8"
"python.pythonPath": "C:\\Users\\david\\AppData\\Local\\Programs\\Python\\Python37\\python.exe"
}
130 changes: 130 additions & 0 deletions centernet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
> :memo: A README.md template for releasing a paper code implementation to a GitHub repository.
>
> * Template version: 1.0.2020.170
> * Please modify sections depending on needs.

# CenterNet

[![Paper](http://img.shields.io/badge/Paper-arXiv.1904.07850-B3181B?logo=arXiv)](https://arxiv.org/abs/1904.07850)

This repository is the unofficial implementation of the following paper.

* Paper title: [Objects as Points](https://arxiv.org/abs/1904.07850)

## Description

CenterNet [1] builds upon CornerNet [2], an anchor-free model for object
detection.

Many other models, such as YOLO and RetinaNet, use anchor boxes. These anchor
boxes are predefined to be close to the aspect ratios and scales of the objects
in the training dataset. Anchor-based models do not predict the bounding boxes
of objects directly. They instead predict the location and size/shape
refinements to a predefined anchor box. The detection generator then computes
the final confidences, positions, and size of the detection.

CornerNet eliminates the need for anchor boxes. RetinaNet needs thousands of
anchor boxes in order to cover the most common ground truth boxes [2]. This adds
unnecessary complexity to the model which slow down training and create
imbalances in positive and negative anchor boxes [2]. Instead, CornerNet creates
heatmaps for each of the corners and pools them together in order to get the
final detection boxes for the objects. CenterNet removes even more complexity
by using the center instead of the corners, meaning that only one set of
heatmaps (one heatmap for each class) is needed to predict the object. CenterNet
proves that this can be done without a significant difference in accuracy.

## History

> :memo: Provide a changelog.

## Authors or Maintainers

> :memo: Provide maintainer information.

* Full name ([@GitHub username](https://github.com/username))
* Full name ([@GitHub username](https://github.com/username))

## Table of Contents

> :memo: Provide a table of contents to help readers navigate a lengthy README document.

## Requirements

[![TensorFlow 2.4](https://img.shields.io/badge/TensorFlow-2.4-FF6F00?logo=tensorflow)](https://github.com/tensorflow/tensorflow/releases/tag/v2.4.0)
[![Python 3.7](https://img.shields.io/badge/Python-3.7-3776AB)](https://www.python.org/downloads/release/python-370/)

```setup
pip install -r requirements.txt
```

## Results

[![TensorFlow Hub](https://img.shields.io/badge/TF%20Hub-Models-FF6F00?logo=tensorflow)](https://tfhub.dev/...)

> :memo: Provide a table with results. (e.g., accuracy, latency)
>
> * Provide links to the pre-trained models (checkpoint, SavedModel files).
> * Publish TensorFlow SavedModel files on TensorFlow Hub (tfhub.dev) if possible.
> * Add links to [TensorBoard.dev](https://tensorboard.dev/) for visualizing metrics.
>
> An example table for image classification results
>
> ### Image Classification
>
> | Model name | Download | Top 1 Accuracy | Top 5 Accuracy |
> |------------|----------|----------------|----------------|
> | Model name | [Checkpoint](https://drive.google.com/...), [SavedModel](https://tfhub.dev/...) | xx% | xx% |

## Dataset

> :memo: Provide information of the dataset used.

## Training

> :memo: Provide training information.
>
> * Provide details for preprocessing, hyperparameters, random seeds, and environment.
> * Provide a command line example for training.

Please run this command line for training.

```shell
python3 ...
```

## Evaluation

> :memo: Provide an evaluation script with details of how to reproduce results.
>
> * Describe data preprocessing / postprocessing steps.
> * Provide a command line example for evaluation.

Please run this command line for evaluation.

```shell
python3 ...
```

## References

[1] CenterNet: Xingyi Zhou, Dequan Wang, and Philipp Krähenbühl. Objects as Points. arXiv preprint arXiv:1904.07850, 2019. (https://arxiv.org/abs/1904.07850)
[2] CornerNet: Hei Law and Jia Deng. CornerNet: Detecting Objects as Paired Keypoints. arXiv preprint arXiv:1808.01244, 2018. (https://arxiv.org/abs/1808.01244)

## License

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

> :memo: Place your license text in a file named LICENSE in the root of the repository.
>
> * Include information about your license.
> * Reference: [Adding a license to a repository](https://help.github.com/en/github/building-a-strong-community/adding-a-license-to-a-repository)

This project is licensed under the terms of the **Apache License 2.0**.

## Citation

> :memo: Make your repository citable.
>
> * Reference: [Making Your Code Citable](https://guides.github.com/activities/citable-code/)

If you want to cite this repository in your research paper, please use the following information.
5 changes: 5 additions & 0 deletions centernet/common/registry_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@
# ==============================================================================
"""All necessary imports for registration."""

import centernet
from centernet.configs import centernet
from centernet.configs.centernet import CenterNetTask
from centernet.modeling.backbones import hourglass
from centernet.tasks.centernet import CenterNetTask
# pylint: disable=unused-import
from official.common import registry_imports
41 changes: 41 additions & 0 deletions centernet/configs/backbones.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Backbones configurations."""
# Import libraries
import dataclasses
from typing import List

from official.modeling import hyperparams
from official.vision.beta.configs import backbones


@dataclasses.dataclass
class Hourglass(hyperparams.Config):
"""Hourglass config."""
input_channel_dims: int = 128
channel_dims_per_stage: List[int] = dataclasses.field(
default_factory=lambda: [256, 256, 384, 384, 384, 512])
blocks_per_stage: List[int] = dataclasses.field(
default_factory=lambda: [2, 2, 2, 2, 2, 4])
num_hourglasses: int = 2
initial_downsample: bool = True
norm_momentum: float = 0.1
norm_episilon: float = 1e-5


@dataclasses.dataclass
class Backbone(backbones.Backbone):
hourglass: Hourglass = Hourglass()
Loading