Skip to content

Commit

Permalink
Merge pull request #2 from vballoli/gh-pages
Browse files Browse the repository at this point in the history
Add project page
  • Loading branch information
vballoli authored Nov 5, 2023
2 parents 82a3ffa + 5d06123 commit ab02fe6
Show file tree
Hide file tree
Showing 213 changed files with 23,284 additions and 0 deletions.
401 changes: 401 additions & 0 deletions code/.gitignore

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions code/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Microsoft Open Source Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).

Resources:

- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
- Contact [[email protected]](mailto:[email protected]) with questions or concerns
21 changes: 21 additions & 0 deletions code/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Microsoft Corporation.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
29 changes: 29 additions & 0 deletions code/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Chanakya: Learning Runtime Decisions for Adaptive Real-Time Perception

This repository contains code for our paper "Chanakya: Learning Runtime Decisions for Adaptive Real-Time Perception" appearing in NeurIPS'23.

## Setup

1. `conda env create -f environment.yml`

## Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

## Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
trademarks or logos is subject to and must follow
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Any use of third-party trademarks or logos are subject to those third-party's policies.
41 changes: 41 additions & 0 deletions code/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.9 BLOCK -->

## Security

Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin).

If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below.

## Reporting Security Issues

**Please do not report security vulnerabilities through public GitHub issues.**

Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report).

If you prefer to submit without logging in, send email to [[email protected]](mailto:[email protected]). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).

You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).

Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:

* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue

This information will help us triage your report more quickly.

If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs.

## Preferred Languages

We prefer all communications to be in English.

## Policy

Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd).

<!-- END MICROSOFT SECURITY.MD BLOCK -->
9 changes: 9 additions & 0 deletions code/SUPPORT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Support

## How to file issues and get help

Please reach out to Anurag Ghosh or [Vaibhav Balloli](mailto:[email protected]) in case of queries. This project is not actively maintained.

## Microsoft Support Policy

Support for this **PROJECT or PRODUCT** is limited to the resources listed above.
48 changes: 48 additions & 0 deletions code/diversity/compute_class_mAP.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import matplotlib.pyplot as plt
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
import numpy as np
import json
import os
import glob
import pickle
import sys
import cv2
from PIL import Image
import mmcv
import time
import pickle

models_name = ['yolo', 'fcos', 'faster_rcnn', 'faster_rcnn_101', 'cascade_rcnn']
type_data = sys.argv[1]

annType = 'bbox'
dataDir='../datasets/coco'
dataType= type_data + '2017'

annFile='{}/annotations/instances_{}.json'.format(dataDir,dataType)
cocoGt=COCO(annFile)
YOUR_CAT_IDS = sorted(cocoGt.getCatIds())

out_file = "/mnt/IoU_results_coco/" + 'per_class_mAP_' + type_data + '.pkl'
final_result_dict = {}

for model_name in models_name:
print("Here is the model name: ",model_name)
resFile = "/mnt/IoU_results_coco/"+ model_name + "/" + type_data + "/" + type_data + ".json"
cocoDt=cocoGt.loadRes(resFile)
coco_eval = COCOeval(cocoGt, cocoDt, annType)
final_result_dict[model_name] = []
stats = []
for i in range(len(YOUR_CAT_IDS)):
coco_eval.params.catIds = YOUR_CAT_IDS[i]
coco_eval.evaluate()
coco_eval.accumulate()
coco_eval.summarize()
stats.append(coco_eval.stats[1])

final_result_dict[model_name] = stats

print(final_result_dict)
with open(out_file, 'wb') as handle:
pickle.dump(final_result_dict, handle, protocol=pickle.HIGHEST_PROTOCOL)
19 changes: 19 additions & 0 deletions code/diversity/compute_cosine.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pickle
from scipy import spatial
import sys

type_data = sys.argv[1]
models_name = ['yolo', 'fcos', 'faster_rcnn', 'faster_rcnn_101', 'cascade_rcnn']
input_file_path = "/mnt/IoU_results_coco/" + 'per_class_mAP_' + type_data + '.pkl'

with open(input_file_path, 'rb') as handle:
final_result_dict = pickle.load(handle)

result_dict = {}
for model_name_1 in models_name:
for model_name_2 in models_name:
diff_string = model_name_1 + '_' +model_name_2
# result_dict[diff_string] = spatial.distance.cosine(normalize(final_result_dict[model_name_1], norm="l1"), normalize(final_result_dict[model_name_2], norm = "l1"))
result_dict[diff_string] = spatial.distance.cosine(final_result_dict[model_name_1], final_result_dict[model_name_2])

print(result_dict)
125 changes: 125 additions & 0 deletions code/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: hams-chanakya
channels:
- defaults
dependencies:
- _libgcc_mutex=0.1=main
- ca-certificates=2020.12.8=h06a4308_0
- certifi=2020.12.5=py37h06a4308_0
- ld_impl_linux-64=2.33.1=h53a641e_7
- libedit=3.1.20191231=h14c3975_1
- libffi=3.3=he6710b0_2
- libgcc-ng=9.1.0=hdf63c60_0
- libstdcxx-ng=9.1.0=hdf63c60_0
- ncurses=6.2=he6710b0_1
- openssl=1.1.1i=h27cfd23_0
- pip=20.3.1=py37h06a4308_0
- python=3.7.9=h7579374_0
- readline=8.0=h7b6447c_0
- setuptools=51.0.0=py37h06a4308_2
- sqlite=3.33.0=h62c20be_0
- tk=8.6.10=hbc83047_0
- wheel=0.36.1=pyhd3eb1b0_0
- xz=5.2.5=h7b6447c_0
- zlib=1.2.11=h7b6447c_3
- pip:
- absl-py==0.10.0
- apache-beam==2.25.0
- astunparse==1.6.3
- attrs==20.3.0
- avro-python3==1.9.2.1
- cachetools==4.1.1
- cffi==1.14.4
- chardet==3.0.4
- contextlib2==0.6.0.post1
- crcmod==1.7
- cycler==0.10.0
- cython==0.29.21
- dataclasses==0.6
- dill==0.3.1.1
- dm-tree==0.1.5
- docopt==0.6.2
- fastavro==1.2.1
- future==0.18.2
- gast==0.3.3
- gin-config==0.4.0
- google-api-core==1.23.0
- google-api-python-client==1.12.8
- google-auth==1.23.0
- google-auth-httplib2==0.0.4
- google-auth-oauthlib==0.4.2
- google-cloud-bigquery==2.6.1
- google-cloud-core==1.4.4
- google-crc32c==1.0.0
- google-pasta==0.2.0
- google-resumable-media==1.1.0
- googleapis-common-protos==1.52.0
- grpcio==1.34.0
- h5py==2.10.0
- hdfs==2.5.8
- httplib2==0.17.4
- idna==2.10
- importlib-metadata==3.1.1
- importlib-resources==3.3.0
- kaggle==1.5.10
- keras-preprocessing==1.1.2
- kiwisolver==1.3.1
- lvis==0.5.3
- lxml==4.6.2
- markdown==3.3.3
- matplotlib==3.3.3
- mock==2.0.0
- numpy==1.18.5
- oauth2client==4.1.3
- oauthlib==3.1.0
- object-detection==0.1
- opencv-contrib-python==4.4.0.46
- opencv-python==4.4.0.46
- opencv-python-headless==4.4.0.46
- opt-einsum==3.3.0
- pandas==1.1.5
- pbr==5.5.1
- pillow==8.0.1
- promise==2.3
- proto-plus==1.13.0
- protobuf==3.14.0
- psutil==5.7.3
- py-cpuinfo==7.0.0
- pyarrow==0.17.1
- pyasn1==0.4.8
- pyasn1-modules==0.2.8
- pycparser==2.20
- pydot==1.4.1
- pymongo==3.11.2
- pyparsing==2.4.7
- python-dateutil==2.8.1
- python-slugify==4.0.1
- pytz==2020.4
- pyyaml==5.3.1
- requests==2.25.0
- requests-oauthlib==1.3.0
- rsa==4.6
- scipy==1.5.4
- sentencepiece==0.1.94
- six==1.15.0
- tensorboard==2.4.0
- tensorboard-plugin-wit==1.7.0
- tensorflow==2.3.1
- tensorflow-addons==0.11.2
- tensorflow-datasets==4.1.0
- tensorflow-estimator==2.3.0
- tensorflow-hub==0.10.0
- tensorflow-metadata==0.25.0
- tensorflow-model-optimization==0.5.0
- termcolor==1.1.0
- text-unidecode==1.3
- tf-models-official==2.3.0
- tf-slim==1.1.0
- tqdm==4.54.1
- typeguard==2.10.0
- typing-extensions==3.7.4.3
- uritemplate==3.0.1
- urllib3==1.26.2
- werkzeug==1.0.1
- wrapt==1.12.1
- zipp==3.4.0
prefix: /home/hamsadmin/anaconda3/envs/hams-chanakya
1 change: 1 addition & 0 deletions code/sap_eval/chanakya
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../scale/
5 changes: 5 additions & 0 deletions code/sap_eval/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"image_service_port": 5007,
"result_service_port": 5008,
"loopback_ip": "127.0.0.1"
}
Loading

0 comments on commit ab02fe6

Please sign in to comment.