More than 20000 images need to be marked
The image is stored in MongoDB. The design is as follows,ProgramThe call data is displayed on the webpage,
It is deemed that the labeling results are retained in MongoDB and all the data is marked successfully.
Two parts: the display part and the data processing part in the background.
Display partCodeAs follows:
<PRE name = "code" class = "html"> <SCRIPT type = "text/JavaScript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"> </SCRIPT> <SCRIPT type = "text/JavaScript "> function output (PARAM) {// alert ($ ('# myimage '). ATTR ('value'); var radiovalue = $ ('input [name = "AAA"]: checked '). val (); // alert (radiovalue); $. ajax ({type: "Get", // method: "Get", datatype: "JSON", data: {"radio": radiovalue, "imageid ": $ ('# myim Age '). ATTR ('value')}, URL: "Save. PHP ", success: function (data) {window. location. reload () ;}}) ;}</SCRIPT> <? PHP $ M = new Mongo (); // select a database $ db = $ M-> fours2; // select a collection (analogous to a relational database's table) $ collection = $ db-> imagelist; $ post = $ collection-> findone (); // element for each image $ imageid = $ post ['_ id']; $ imageurl = $ post ['url']; $ venueid = $ post ['venue _ id']; $ venueurl = $ post ['venue _ url']; $ venuename = $ post ['venue _ name']; $ strimageurl = '<center> </center> <br> '; $ strimageid =' <center> <Div id = "myimage" value = "'. $ imageid. '"> image_id :'. $ imageid. '</div> </center>'; $ strvenueid = '<center> <div> venue_id :'. $ venueid. '</div> </center>'; $ strvenuename = '<center> <div> venue_name :'. $ venuename. '</div> </center>'; $ strvenueurl = '<center> <a href = "'. $ venueurl. '"> venue_url :'. $ venueurl. '</a> </center>'; // $ imageurl = explode ("", $ I Mageurl); // output result echo $ strimageurl; echo $ strimageid; echo $ strvenueid; echo $ strvenuename; echo $ strvenueurl; echo '<center> <input type = "radio" name = "AAA" value = "1"/> Yes <input type = "radio" name = "AAA" value =" 0 "/> NO <input type =" button "style =" width: 70 "width = 70 value =" Next "onclick =" output (this) "/> </center> '; // iterate through the results // echo var_dump ($ cursor);?>
The program code processed in the background, written in PHP:
<? PHP $ M = new Mongo (); // select a database $ db = $ M-> fours2; // select a collection (analogous to a relational database's table) $ collection = $ db-> annotationimage; $ imagelist = $ db-> imagelist; $ value = $ _ Get ['radio']; $ imageid = $ _ Get ['imageid']; $ query = array ("_ id" => $ imageid); $ imageinf = $ imagelist-> findone ($ query ); $ imageinf ['flag'] = $ value; $ collection-> Save ($ imageinf); $ imagelist-> remove ($ query);?>