Commit 14fd3832 authored by A. Unique TensorFlower's avatar A. Unique TensorFlower
Browse files

Internal change

PiperOrigin-RevId: 467737798
parent 64ab566d
...@@ -12,6 +12,20 @@ ...@@ -12,6 +12,20 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# Copyright 2022 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.
"""Create a list of dictionaries for categories according to the taxonomy. """Create a list of dictionaries for categories according to the taxonomy.
Example usage- Example usage-
...@@ -46,6 +60,11 @@ MATERIAL_SUBCATEGORY_LIST = [ ...@@ -46,6 +60,11 @@ MATERIAL_SUBCATEGORY_LIST = [
'Non-ferrous_Zinc' 'Non-ferrous_Zinc'
] ]
PLASTICS_SUBCATEGORY_LIST = [
'HDPE', 'PETE', 'LDPE', 'PS', 'PP', 'PVC', 'Others-MLP', 'Others-Tetrapak',
'Others-HIPC'
]
def build_material(category_list: List[str], def build_material(category_list: List[str],
supercategory: str) -> List[Dict[str, Union[int, str]]]: supercategory: str) -> List[Dict[str, Union[int, str]]]:
...@@ -53,9 +72,10 @@ def build_material(category_list: List[str], ...@@ -53,9 +72,10 @@ def build_material(category_list: List[str],
Args: Args:
category_list: list of categories from MATERIAL_LIST, MATERIAL_FORM_LIST, category_list: list of categories from MATERIAL_LIST, MATERIAL_FORM_LIST,
MATERIAL_SUBCATEGORY_LIST MATERIAL_SUBCATEGORY_LIST, PLASTICS_SUBCATEGORY_LIST
supercategory: supercategory can be 'material-types', 'material-form-types', supercategory: supercategory can be 'material-types', 'material-form-types',
'material-subcategory-types', 'material-form-subcategory-types' 'material-subcategory-types', 'material-form-subcategory-types',
'plastic-types'
Returns: Returns:
List of dictionaries returning categories with their IDs List of dictionaries returning categories with their IDs
......
{"images":[{"height":2048,"width":2592,"id":1,"file_name":"ffdeb4cd-43ba-4ca0-a1e6-aa5824005f44.jpg"},{"height":1080,"width":1920,"id":2,"file_name":"20210826-105712.png"}],"annotations":[{"iscrowd":0,"image_id":1,"bbox":[832,255,729,697],"segmentation":[[994,255,990,398,989,536,996,565,971,624,832,772,852,801,937,817,1113,870,1247,903,1304,941,1363,941,1392,951,1413,834,1458,711,1511,572,1561,401,1561,386,1377,337,1059,258]],"category_id":0,"id":1,"area":311359},{"iscrowd":0,"image_id":2,"bbox":[84,305,105,116],"segmentation":[[84,346,87,377,100,399,137,420,174,417,189,378,186,340,169,319,147,304,115,311,94,325]],"category_id":1,"id":2,"area":9352},{"iscrowd":0,"image_id":2,"bbox":[671,80,232,105],"segmentation":[[689,107,697,174,742,177,798,185,887,172,903,162,897,98,887,88,858,80,829,80,810,104,766,103,671,104]],"category_id":2,"id":3,"area":17023},{"iscrowd":0,"image_id":2,"bbox":[646,235,234,376],"segmentation":[[645,243,655,282,652,311,655,346,661,383,679,419,710,483,745,554,760,590,768,603,774,607,790,611,831,591,871,556,879,530,836,465,760,311,697,261,668,235]],"category_id":3,"id":4,"area":41260},{"iscrowd":0,"image_id":2,"bbox":[54,640,342,284],"segmentation":[[355,640,187,761,60,875,53,888,87,914,105,924,160,891,227,845,281,798,303,774,348,745,394,704,395,678]],"category_id":4,"id":5,"area":30998},{"iscrowd":0,"image_id":2,"bbox":[513,622,248,202],"segmentation":[[513,733,631,665,660,664,687,659,724,641,731,632,745,622,761,646,761,667,744,678,716,693,684,714,676,743,550,824]],"category_id":5,"id":6,"area":19383}],"categories":[{"id":0,"name":"plastics_HDPE_flexible_color_SAchets-&-pouch_pouch","supercategory":"plastics_HDPE_flexible_color_SAchets-&-pouch_pouch"},{"id":1,"name":"Plastics_HDPE_Rigid_Blue_Lid_Bottle-Cap_Na_Na","supercategory":"Plastics_HDPE_Rigid_Blue_Lid_Bottle-Cap_Na_Na"},{"id":2,"name":"Plastics_peTE_Na_Clear_Bottle_Shampoo-Bottle_250Ml_Vlcc","supercategory":"Plastics_peTE_Na_Clear_Bottle_Shampoo-Bottle_250Ml_Vlcc"},{"id":3,"name":"Plastics_na_Rigid_Blue_Bottle_Hair-Oil-Bottle-500Ml_Parachute","supercategory":"Plastics_na_Rigid_Blue_Bottle_Hair-Oil-Bottle-500Ml_Parachute"},{"id":4,"name":"Plastics_HDPE_Rigid_Na_Cosmetic_Comb_Na_Na","supercategory":"Plastics_HDPE_Rigid_Na_Cosmetic_Comb_Na_Na"},{"id":5,"name":"Plastics_PETE_Na_Clear_Bottle_Energy-Drink-Bottle_250Ml_Sting-Energy","supercategory":"Plastics_PETE_Na_Clear_Bottle_Energy-Drink-Bottle_250Ml_Sting-Energy"}]} {"images":[{"height":2048,"width":2592,"id":1,"file_name":"ffdeb4cd-43ba-4ca0-a1e6-aa5824005f44.jpg"},{"height":1080,"width":1920,"id":2,"file_name":"image_2.png"}],"annotations":[{"iscrowd":0,"image_id":1,"bbox":[832,255,729,697],"segmentation":[[994,255,990,398,989,536,996,565,971,624,832,772,852,801,937,817,1113,870,1247,903,1304,941,1363,941,1392,951,1413,834,1458,711,1511,572,1561,401,1561,386,1377,337,1059,258]],"category_id":0,"id":1,"area":311359},{"iscrowd":0,"image_id":2,"bbox":[84,305,105,116],"segmentation":[[84,346,87,377,100,399,137,420,174,417,189,378,186,340,169,319,147,304,115,311,94,325]],"category_id":1,"id":2,"area":9352},{"iscrowd":0,"image_id":2,"bbox":[671,80,232,105],"segmentation":[[689,107,697,174,742,177,798,185,887,172,903,162,897,98,887,88,858,80,829,80,810,104,766,103,671,104]],"category_id":2,"id":3,"area":17023},{"iscrowd":0,"image_id":2,"bbox":[646,235,234,376],"segmentation":[[645,243,655,282,652,311,655,346,661,383,679,419,710,483,745,554,760,590,768,603,774,607,790,611,831,591,871,556,879,530,836,465,760,311,697,261,668,235]],"category_id":3,"id":4,"area":41260},{"iscrowd":0,"image_id":2,"bbox":[54,640,342,284],"segmentation":[[355,640,187,761,60,875,53,888,87,914,105,924,160,891,227,845,281,798,303,774,348,745,394,704,395,678]],"category_id":4,"id":5,"area":30998},{"iscrowd":0,"image_id":2,"bbox":[513,622,248,202],"segmentation":[[513,733,631,665,660,664,687,659,724,641,731,632,745,622,761,646,761,667,744,678,716,693,684,714,676,743,550,824]],"category_id":5,"id":6,"area":19383}],"categories":[{"id":0,"name":"plastics_HDPE_flexible_color_SAchets-&-pouch_pouch","supercategory":"plastics_HDPE_flexible_color_SAchets-&-pouch_pouch"},{"id":1,"name":"Plastics_HDPE_Rigid_Blue_Lid_Bottle-Cap_Na_Na","supercategory":"Plastics_HDPE_Rigid_Blue_Lid_Bottle-Cap_Na_Na"},{"id":2,"name":"Plastics_peTE_Na_Clear_Bottle_Shampoo-Bottle_250Ml_Vlcc","supercategory":"Plastics_peTE_Na_Clear_Bottle_Shampoo-Bottle_250Ml_Vlcc"},{"id":3,"name":"Plastics_na_Rigid_Blue_Bottle_Hair-Oil-Bottle-500Ml_Parachute","supercategory":"Plastics_na_Rigid_Blue_Bottle_Hair-Oil-Bottle-500Ml_Parachute"},{"id":4,"name":"Plastics_HDPE_Rigid_Na_Cosmetic_Comb_Na_Na","supercategory":"Plastics_HDPE_Rigid_Na_Cosmetic_Comb_Na_Na"},{"id":5,"name":"Plastics_PETE_Na_Clear_Bottle_Energy-Drink-Bottle_250Ml_Sting-Energy","supercategory":"Plastics_PETE_Na_Clear_Bottle_Energy-Drink-Bottle_250Ml_Sting-Energy"}]}
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment