Comments (4)
@gnarf suggested having one truth table called known
with a column for seed versus consensus:
CREATE TABLE known (
id SERIAL PRIMARY KEY,
image_id INTEGER NOT NULL REFERENCES image(id),
annotation_type_id INTEGER NOT NULL REFERENCES annotation_type(id),
data JSONB NOT NULL,
is_seed BOOLEAN NOT NULL DEFAULT false,
UNIQUE(image_id, annotation_type_id)
);
from ajl.ai.
We can use this crazy sql (that tyler could probably optimize) to get the images for the workload.
-- First, select the total count of annotaiton types
WITH types as (
SELECT
COUNT(*) as count
FROM
annotation_type
),
-- How many known truths are present for each image
known_count as (
SELECT
image_id,
COUNT(*) as count
FROM
known
GROUP BY image_id
),
-- Each annotator should never see the same image twice
annotator as (
SELECT
image_id,
count(*) as count
FROM image_annotation
WHERE annotater_id = ${annotatorId}
GROUP BY image_id
),
-- Look for images, calculate if we can use them as knowns
-- restrict the images we've annotated, and randomize order
truth_table as (
SELECT
image.id,
image.url,
image.width,
image.height,
COALESCE(known.count = types.count, false) as is_known
FROM
image
LEFT JOIN known_count known on image.id = known.image_id
LEFT JOIN annotator on image.id = annotator.image_id,
types
WHERE
annotator.count is null
ORDER BY RANDOM()
),
-- Select the first "8" (2/3's of the limit) known images
truths as (
SELECT * FROM truth_table WHERE is_known LIMIT ${numTruths}
),
-- Select a whole "limit" bucket of unknown images
news as (
SELECT * FROM truth_table WHERE NOT(is_truth) LIMIT ${limit}
)
-- Select the union of the known images, and unknown images, limiting to
-- the total limit (so because we "overfilled" the buffer for the unknowns)
-- it will always give us 12 images, with up to `numTruths` truths if we
-- had them...
SELECT * FROM truths
UNION ALL
SELECT * FROM news
LIMIT ${limit};
from ajl.ai.
Creating some seed truths based on my own annotations:
{"workloadId":275,"images":[{"id":690,"annotations":[{"name":"Perceived Age","option":"young adult"},{"name":"Perceived Gender","option":"female"},{"name":"Perceived Ethnicity","option":"white"}]},{"id":3060,"annotations":[{"name":"Perceived Age","option":"adult"},{"name":"Perceived Gender","option":"female"},{"name":"Perceived Ethnicity","option":"black"}]},{"id":1310,"annotations":[{"name":"Perceived Age","option":"adult"},{"name":"Perceived Gender","option":"male"},{"name":"Perceived Ethnicity","option":"white"}]}]}
{"workloadId":276,"images":[{"id":2668,"annotations":[{"name":"Perceived Age","option":"adult"},{"name":"Perceived Gender","option":"female"},{"name":"Perceived Ethnicity","option":"white"}]},{"id":3368,"annotations":[{"name":"Perceived Age","option":"adult"},{"name":"Perceived Gender","option":"female"},{"name":"Perceived Ethnicity","option":"white"}]},{"id":4070,"annotations":[{"name":"Perceived Age","option":"adult"},{"name":"Perceived Gender","option":"male"},{"name":"Perceived Ethnicity","option":"black"}]}]}
{"workloadId":277,"images":[{"id":2434,"annotations":[{"name":"Perceived Age","option":"adult"},{"name":"Perceived Gender","option":"female"},{"name":"Perceived Ethnicity","option":"asian"}]},{"id":1863,"annotations":[{"name":"Perceived Age","option":"adult"},{"name":"Perceived Gender","option":"female"},{"name":"Perceived Ethnicity","option":"white"}]},{"id":1979,"annotations":[{"name":"Perceived Age","option":"adult"},{"name":"Perceived Gender","option":"male"},{"name":"Perceived Ethnicity","option":"white"}]}]}
{"workloadId":278,"images":[{"id":3116,"annotations":[{"name":"Perceived Age","option":"adult"},{"name":"Perceived Gender","option":"male"},{"name":"Perceived Ethnicity","option":"white"}]},{"id":2827,"annotations":[{"name":"Perceived Age","option":"adult"},{"name":"Perceived Gender","option":"female"},{"name":"Perceived Ethnicity","option":"white"}]},{"id":3528,"annotations":[{"name":"Perceived Age","option":"adult"},{"name":"Perceived Gender","option":"male"},{"name":"Perceived Ethnicity","option":"not listed"}]}]}
{"workloadId":279,"images":[{"id":826,"annotations":[{"name":"Perceived Age","option":"adult"},{"name":"Perceived Gender","option":"male"},{"name":"Perceived Ethnicity","option":"white"}]},{"id":1515,"annotations":[{"name":"Perceived Age","option":"adult"},{"name":"Perceived Gender","option":"male"},{"name":"Perceived Ethnicity","option":"white"}]},{"id":3178,"annotations":[{"name":"Perceived Age","option":"adult"},{"name":"Perceived Gender","option":"male"},{"name":"Perceived Ethnicity","option":"white"}]}]}
from ajl.ai.
resolved by #78
from ajl.ai.
Related Issues (20)
- Update Annotations User Flow
- Update Ethnicity Labels
- Update Navigation
- improve mobile ux (minimize scrolling) HOT 1
- move feedback messaging frame to review summary page
- Consent Module Line Heights / Font Size
- Previous image Persists until new one is loaded, making it seem as if new tags are being submitted to old tags
- Update Good Image Button Text
- Add User Demographics
- PreLaumch Testing
- Enabling Stubs for Final Sprint
- Submit Tags Skipped
- Import VGG Faces HOT 7
- Update production to annotate only vgg + lfw
- create ajl Google analytics HOT 1
- VGG Only Include Curated Images for Full Dataset
- Automate SSL Renewal on staging & production
- Reposition/Remove Feedback Button From Messages Header
- Update Demographics Flow
- ssl
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ajl.ai.