Skip to content

Commit

Permalink
WeedCOCO category names are now a combination of role and species
Browse files Browse the repository at this point in the history
Fixes #83

Fixes #57

Helps towards specifying categories in importers (#33, #34)
  • Loading branch information
jnothman committed Sep 23, 2020
1 parent ceb8f9c commit 7d392ec
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 18 deletions.
18 changes: 4 additions & 14 deletions search/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class App extends Component {
queryFormat: "or",
URLParams: true,
react: {
and: ["searchbox", "resslider", "agcontextfilter", "rolefilter", "speciesfilter", "grainstextfilter"]
and: ["searchbox", "resslider", "agcontextfilter", "categoryfilter", "grainstextfilter"]
},
...multilistFacetProps
}
Expand Down Expand Up @@ -60,24 +60,14 @@ class App extends Component {
>
<div style={{ position: "fixed", width: "20rem", overflow: "scroll", height: "100%" }}>
<MultiList
componentId="rolefilter"
title="Filter by role"
dataField="annotation__category__role.keyword"
sortBy="asc"
selectAllLabel="All roles"
placeholder="Search Role"
filterLabel="Role"
{...makeProps("rolefilter", true)}
/>
<MultiList
componentId="speciesfilter"
componentId="categoryfilter"
title="Filter by species"
dataField="annotation__category__species.keyword"
dataField="annotation__category__name.keyword"
sortBy="asc"
selectAllLabel="All species"
placeholder="Search Species"
filterLabel="Species"
{...makeProps("speciesfilter", true)}
{...makeProps("categoryfilter", true)}
/>
<MultiList
componentId="agcontextfilter"
Expand Down
6 changes: 4 additions & 2 deletions weedcoco/cwfid_to_json/cwfid_imageinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -17269,6 +17269,7 @@
],
"categories": [
{
"name": "crop: daugus carota",
"common_name": "carrot",
"species": "daugus carota",
"eppo_taxon_code": "DAUCS",
Expand All @@ -17277,6 +17278,7 @@
"id": 0
},
{
"name": "weed: UNSPECIFIED",
"species": "UNSPECIFIED",
"role": "weed",
"id": 1
Expand Down Expand Up @@ -17316,7 +17318,7 @@
"location_lat": 53,
"location_long": 11,
"location_datum": 4326,
"upload_time": "2020-09-02 23:21:11",
"upload_time": "2020-09-23 17:21:34",
"camera_make": "JAI AD-130GE",
"camera_lens": "Fujinon TF15-DA-8",
"camera_lens_focallength": 15,
Expand Down Expand Up @@ -17415,4 +17417,4 @@
"collection_id": 0
}
]
}
}
11 changes: 10 additions & 1 deletion weedcoco/deepweeds_to_json/deepweeds_imageinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -262640,60 +262640,69 @@
],
"categories": [
{
"name": "weed: chinee apple",
"common_name": "chinee apple",
"id": 0,
"role": "weed",
"species": "ziziphus mauritiana",
"eppo_taxon_code": "ZIPMA"
},
{
"name": "weed: lantana",
"common_name": "lantana",
"id": 1,
"role": "weed",
"species": "lantana camara",
"eppo_taxon_code": "LANCA"
},
{
"name": "none",
"common_name": "negative",
"id": 8,
"role": "na"
},
{
"name": "weed: snake weed",
"common_name": "snake weed",
"id": 7,
"role": "weed",
"species": "gutierrezia sarothrae",
"eppo_taxon_code": "GUESA"
},
{
"name": "weed: siam weed",
"common_name": "siam weed",
"id": 6,
"role": "weed",
"species": "chromolaena odorata",
"eppo_taxon_code": "EUPOD"
},
{
"name": "weed: prickly acacia",
"common_name": "prickly acacia",
"id": 4,
"role": "weed",
"species": "vachellia nilotica",
"eppo_taxon_code": "ACANL"
},
{
"name": "weed: parthenium",
"common_name": "parthenium",
"id": 3,
"role": "weed",
"species": "parthenium hysterophorus",
"eppo_taxon_code": "PTNHY"
},
{
"name": "weed: rubber vine",
"common_name": "rubber vine",
"id": 5,
"role": "weed",
"species": "cryptostegia grandiflora",
"eppo_taxon_code": "CVRGR"
},
{
"name": "weed: parkinsonia",
"common_name": "parkinsonia",
"id": 2,
"role": "weed",
Expand Down Expand Up @@ -262759,4 +262768,4 @@
"id": 0
}
]
}
}
8 changes: 7 additions & 1 deletion weedcoco/importers/cwfid.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,20 @@
CATEGORY_MAP = {
# TODO: we need a spec for species unspecified, and we need a spec for species specified
"crop": {
"name": "crop: daugus carota",
"common_name": "carrot",
"species": "daugus carota",
"eppo_taxon_code": "DAUCS",
"eppo_nontaxon_code": "3UMRC",
"role": "crop",
"id": 0,
},
"weed": {"species": "UNSPECIFIED", "role": "weed", "id": 1},
"weed": {
"name": "weed: UNSPECIFIED",
"species": "UNSPECIFIED",
"role": "weed",
"id": 1,
},
}


Expand Down
4 changes: 4 additions & 0 deletions weedcoco/importers/deepweeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,12 @@
# Generate category objects
if categoryID not in categoryIDToCategories:
category = {}
category["name"] = row["Species"].lower()
category["common_name"] = row["Species"].lower()
category["id"] = row["Label"]
categoryIDToCategories[categoryID] = category
if category["common_name"] == "negative":
category["name"] = "none"
category["role"] = "na"
else:
category["role"] = "weed"
Expand Down Expand Up @@ -140,6 +142,8 @@
if category["common_name"] == "parkinsonia":
category["species"] = "parkinsonia aculeata"
category["eppo_taxon_code"] = "PAKAC"
if "name" not in category:
category["name"] = f"{category['role']}: {category['species']}"

# Create an annotation
ann = {}
Expand Down
29 changes: 29 additions & 0 deletions weedcoco/schema/Category.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
$id: https://weedid.sydney.edu.au/schema/Category.json
type: object
required:
- id
- name

properties:
id:
type: number
description: |-
A number identifying the image.
name:
type: string
pattern: ^((crop|weed): ([a-z]+|UNSPECIFIED)|crop|weed|none)$
description: |-
A category for an annotation, consisting of an agricultural role and
optionally a biological name, separated by ": ". Currently allowed
agricultural roles are "weed" and "crop". The "none" category may be
used to indicate that no weed or crop is identified in the image.
Annotations should be labelled with the most specific category possible,
usually "weed: <species name>", but super categories may be more general.
Biological names should be lowercase.
For an unspecified species of weed, "weed: UNSPECIFIED" may be used.
For example, to label an oat crop in an image, the category name would be
"crop: avena sativa". Its super categories may include "crop: grasses"
and "crop". Oats as a volunteer crop would be "weed: avena sativa".
4 changes: 4 additions & 0 deletions weedcoco/schema/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ properties:
type: array
items:
$ref: https://weedid.sydney.edu.au/schema/Annotation.json#/
categories:
type: array
items:
$ref: https://weedid.sydney.edu.au/schema/Category.json#/
agcontexts:
type: array
items:
Expand Down

0 comments on commit 7d392ec

Please sign in to comment.