Пример #1
0
        public static void CreateDemoJob_OBJECT_COUNTING_IN_VIDEO()
        {
            SatyamJob job = new SatyamJob();

            AzureInformation AzureInfo = new AzureInformation();

            AzureInfo.AzureBlobStorageConnectionString       = SatyamJobStorageAccountAccess.connection_string;
            AzureInfo.AzureBlobStorageContainerName          = "demo";
            AzureInfo.AzureBlobStorageContainerDirectoryName = "PedestrianCountingDemo";

            AmazonMTurkHITInformation AmazonInfo = new AmazonMTurkHITInformation();


            ObjectCountingSubmittedJob template = new ObjectCountingSubmittedJob();

            template.ObjectName  = "pedestrian";
            template.Description = "By pedestrians we mean people walking or on wheel chairs not cyclists.";

            job.JobGUIDString        = "OBJECT_COUNTING_IN_VIDEO_DEMO";
            job.amazonHITInformation = AmazonInfo;
            job.azureInformation     = AzureInfo;
            job.JobSubmitTime        = DateTime.Now;
            job.JobTemplateType      = "OBJECT_COUNTING_IN_VIDEO_DEMO";
            job.UserID = TaskConstants.AdminName;

            job.JobParameters = JSonUtils.ConvertObjectToJSon <ObjectCountingSubmittedJob>(template);

            string JobParametersString = JSonUtils.ConvertObjectToJSon <SatyamJob>(job);

            SatyamJobSubmissionsTableAccess jobDB = new SatyamJobSubmissionsTableAccess();

            jobDB.AddEntry(job.JobTemplateType, job.UserID, job.JobGUIDString, JobParametersString, job.JobSubmitTime);
            jobDB.close();
        }
Пример #2
0
        public static void CreateDemoJob_SINGLE_OBJECT_LABLING()
        {
            SatyamJob job = new SatyamJob();

            Console.WriteLine("here 1");

            AzureInformation AzureInfo = new AzureInformation();

            AzureInfo.AzureBlobStorageConnectionString       = SatyamJobStorageAccountAccess.connection_string;
            AzureInfo.AzureBlobStorageContainerName          = "demo";
            AzureInfo.AzureBlobStorageContainerDirectoryName = "testSingleObjectLabelingImages";

            AmazonMTurkHITInformation AmazonInfo = new AmazonMTurkHITInformation();


            SingleObjectLabelingSubmittedJob template = new SingleObjectLabelingSubmittedJob();
            List <string> categories = new List <string>()
            {
                "Car", "Bus"
            };

            template.Categories  = categories;
            template.Description = "Car: Includes SUV's, Vans with upto 6 passengers, Jeeps and Pickcups. Click <a href=\"http://satyamtaskpages.azurewebsites.net/CategoryExamplesPageForDemo.aspx\"> here</a> to see examples of the various categories.";

            job.JobGUIDString        = "SINGLE_OBJECT_LABLING_DEMO";
            job.amazonHITInformation = AmazonInfo;
            job.azureInformation     = AzureInfo;
            job.JobSubmitTime        = DateTime.Now;
            job.JobTemplateType      = "SINGLE_OBJECT_LABLING_DEMO";
            job.UserID = TaskConstants.AdminName;


            job.JobParameters = JSonUtils.ConvertObjectToJSon <SingleObjectLabelingSubmittedJob>(template);

            string JobParametersString = JSonUtils.ConvertObjectToJSon <SatyamJob>(job);

            SatyamJobSubmissionsTableAccess jobDB = new SatyamJobSubmissionsTableAccess();

            jobDB.AddEntry(job.JobTemplateType, job.UserID, job.JobGUIDString, JobParametersString, job.JobSubmitTime);
            jobDB.close();
        }
Пример #3
0
        public static void CreateDemoJob_SINGLE_OBJECT_LABLING_IN_VIDEO()
        {
            SatyamJob job = new SatyamJob();

            AzureInformation AzureInfo = new AzureInformation();

            AzureInfo.AzureBlobStorageConnectionString       = SatyamJobStorageAccountAccess.connection_string;
            AzureInfo.AzureBlobStorageContainerName          = "demo";
            AzureInfo.AzureBlobStorageContainerDirectoryName = "TestVideoClassificationMP4";

            AmazonMTurkHITInformation AmazonInfo = new AmazonMTurkHITInformation();


            SingleObjectLabelingSubmittedJob template = new SingleObjectLabelingSubmittedJob();
            List <string> categories = new List <string>()
            {
                "Biking", "HorseRiding", "SkateBoarding"
            };

            template.Categories  = categories;
            template.Description = "";

            job.JobGUIDString        = "SINGLE_OBJECT_LABLING_IN_VIDEO_DEMO";
            job.amazonHITInformation = AmazonInfo;
            job.azureInformation     = AzureInfo;
            job.JobSubmitTime        = DateTime.Now;
            job.JobTemplateType      = "SINGLE_OBJECT_LABLING_IN_VIDEO_DEMO";
            job.UserID = TaskConstants.AdminName;


            job.JobParameters = JSonUtils.ConvertObjectToJSon <SingleObjectLabelingSubmittedJob>(template);

            string JobParametersString = JSonUtils.ConvertObjectToJSon <SatyamJob>(job);

            SatyamJobSubmissionsTableAccess jobDB = new SatyamJobSubmissionsTableAccess();

            jobDB.AddEntry(job.JobTemplateType, job.UserID, job.JobGUIDString, JobParametersString, job.JobSubmitTime);
            jobDB.close();
        }
Пример #4
0
        public static void CreateDemoJob_OBJECT_COUNTING_IN_IMAGE()
        {
            SatyamJob job = new SatyamJob();

            Console.WriteLine("here 1");

            AzureInformation AzureInfo = new AzureInformation();

            AzureInfo.AzureBlobStorageConnectionString       = SatyamJobStorageAccountAccess.connection_string;
            AzureInfo.AzureBlobStorageContainerName          = "demo";
            AzureInfo.AzureBlobStorageContainerDirectoryName = "catsCount";

            AmazonMTurkHITInformation AmazonInfo = new AmazonMTurkHITInformation();


            ObjectCountingSubmittedJob template = new ObjectCountingSubmittedJob();

            template.ObjectName  = "cat";
            template.Description = "By cat we mean house cat and not the general category of cat family like lions or tigers.";

            job.JobGUIDString        = "OBJECT_COUNTING_IN_IMAGE_DEMO";
            job.amazonHITInformation = AmazonInfo;
            job.azureInformation     = AzureInfo;
            job.JobSubmitTime        = DateTime.Now;
            job.JobTemplateType      = "OBJECT_COUNTING_IN_IMAGE_DEMO";
            job.UserID = TaskConstants.AdminName;

            job.JobParameters = JSonUtils.ConvertObjectToJSon <ObjectCountingSubmittedJob>(template);

            string JobParametersString = JSonUtils.ConvertObjectToJSon <SatyamJob>(job);

            SatyamJobSubmissionsTableAccess jobDB = new SatyamJobSubmissionsTableAccess();

            jobDB.AddEntry(job.JobTemplateType, job.UserID, job.JobGUIDString, JobParametersString, job.JobSubmitTime);
            jobDB.close();
        }
        protected void JobSubmitButton_Click(object sender, EventArgs e)
        {
            string AzureBlobStorageConnectionString = AzureBlobStorageConnectionStringTextBox.Text;
            string AzureContainer               = AzureBlobStorageContainerNameTextBox.Text;
            string AzureContainerDirectory      = AzureBlobStorageContainerDirectoryNameTextBox.Text;
            string AmazonAccessKeyIDValue       = AmazonAccessKeyID.Text;
            string AmazonSecretAccessKeyIDValue = AmazonSecretAccessKeyID.Text;
            string Description           = CategoryDescription.Text;
            double pricePerImage         = 0;
            double price                 = 0;
            string jobGuid               = NewJobGUID.Text;
            string AmazonTaskTitle       = AmazonTaskTitleTextBox.Text;
            string AmazonTaskDescription = AmazonTaskDescriptionTextBox.Text;
            string AmazonTaskKeywords    = AmazonTaskKeywordsTextBox.Text;

            if (AzureBlobStorageConnectionString == "" || AzureContainer == "")
            {
                Template_ErrorMessageLabel.Text      = "Error : Azure Connection String and Container are mandatory fields.";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }

            AzureConnectionInfo connectionInfo = new AzureConnectionInfo(AzureBlobStorageConnectionString, AzureContainer, AzureContainerDirectory);
            int noFiles = connectionInfo.getNoFiles();

            if (noFiles == -1)
            {
                Template_ErrorMessageLabel.Text      = "Error :  Invalid Azure Location";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }
            else if (noFiles == 0)
            {
                Template_ErrorMessageLabel.Text      = "Error :  There are 0 files at the Azure Location";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }


            if (Hidden_MechanicalTurk.Value == "true")
            {
                bool success = Double.TryParse(PriceTextBox.Text, out pricePerImage);
                if (!success)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Non-numerical price entered";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
                pricePerImage = pricePerImage / 100; //convert to dollars
                price         = pricePerImage;

                //need to round to cents
                price = Math.Floor(price * 100) / 100;

                if (price <= 0)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  The Price is Zero";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
                AmazonMTurkHIT hit = new AmazonMTurkHIT();
                success = hit.setAccount(AmazonAccessKeyIDValue, AmazonSecretAccessKeyIDValue, false);
                if (!success)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Invalid Amazon Turk Account";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
                double balance = hit.getAccountBalance();
                if (balance < 0)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Invalid Amazon Turk Account";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
                double moneyNeeded = 4 * price * noFiles / TaskConstants.SINGLE_OBJECT_LABLING_MTURK_MAX_IMAGES_PER_TASK;
                if (balance < moneyNeeded)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Insufficient money in Amazon Turk Account. You will need at least " + moneyNeeded + "$.";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }


                if (AmazonTaskTitle == "")
                {
                    Template_ErrorMessageLabel.Text = "Image Classification Task";
                }

                if (AmazonTaskTitle == "")
                {
                    Template_ErrorMessageLabel.Text = "Quickly earn money by simply selecting what an image looks like!";
                }



                if (AmazonTaskKeywords == "Pictures, Classify, Categorize")
                {
                    Template_ErrorMessageLabel.Text = "";
                }
            }



            AzureInformation AzureInfo = new AzureInformation();

            AzureInfo.AzureBlobStorageConnectionString       = AzureBlobStorageConnectionString;
            AzureInfo.AzureBlobStorageContainerName          = AzureContainer;
            AzureInfo.AzureBlobStorageContainerDirectoryName = AzureContainerDirectory;

            AmazonMTurkHITInformation AmazonInfo = new AmazonMTurkHITInformation();

            if (Hidden_MechanicalTurk.Value == "true")
            {
                AmazonInfo.AmazonAccessKeyID       = AmazonAccessKeyIDValue;
                AmazonInfo.AmazonSecretAccessKeyID = AmazonSecretAccessKeyIDValue;
                AmazonInfo.Price = price; //in dollars
                AmazonInfo.AmazonMTurkTaskTitle       = AmazonTaskTitle;
                AmazonInfo.AmazonMTurkTaskDescription = AmazonTaskDescription;
                AmazonInfo.AmazonMTurkTaskKeywords    = AmazonTaskKeywords;
            }
            else
            {
                AmazonInfo.AmazonAccessKeyID       = "";
                AmazonInfo.AmazonSecretAccessKeyID = "";
                AmazonInfo.Price = 0;
                AmazonInfo.AmazonMTurkTaskTitle       = "";
                AmazonInfo.AmazonMTurkTaskDescription = "";
                AmazonInfo.AmazonMTurkTaskKeywords    = "";
            }

            SingleObjectLabelingSubmittedJob jobParameters = new SingleObjectLabelingSubmittedJob();

            jobParameters.Description = Description;

            SatyamJob job = new SatyamJob();

            job.UserID = userName;
            job.amazonHITInformation = AmazonInfo;
            job.azureInformation     = AzureInfo;
            job.JobGUIDString        = jobGuid;
            if (Hidden_MechanicalTurk.Value == "true")
            {
                job.JobTemplateType = TaskConstants.CameraPoseEsitmation_MTurk;
                job.TasksPerJob     = 1;
            }
            else
            {
                job.JobTemplateType = TaskConstants.CameraPoseEsitmation;
                job.TasksPerJob     = 0; //does not matter
            }
            job.JobSubmitTime = DateTime.Now;
            job.JobParameters = JSonUtils.ConvertObjectToJSon <SingleObjectLabelingSubmittedJob>(jobParameters);
            string jobDefinition = JSonUtils.ConvertObjectToJSon <SatyamJob>(job);

            SatyamJobSubmissionsTableAccess dbAccess = new SatyamJobSubmissionsTableAccess();

            dbAccess.AddEntry(job.JobTemplateType, job.UserID, job.JobGUIDString, jobDefinition, job.JobSubmitTime);
            dbAccess.close();
            Response.Redirect("NewJobSubmitted.aspx");
        }
        protected void JobSubmitButton_Click(object sender, EventArgs e)
        {
            string AzureBlobStorageConnectionString = AzureBlobStorageConnectionStringTextBox.Text;
            string AzureContainer               = AzureBlobStorageContainerNameTextBox.Text;
            string AzureContainerDirectory      = AzureBlobStorageContainerDirectoryNameTextBox.Text;
            string AmazonAccessKeyIDValue       = AmazonAccessKeyID.Text;
            string AmazonSecretAccessKeyIDValue = AmazonSecretAccessKeyID.Text;
            string Description           = CategoryDescription.Text;
            string jobGuid               = NewJobGUID.Text;
            string AmazonTaskTitle       = AmazonTaskTitleTextBox.Text;
            string AmazonTaskDescription = AmazonTaskDescriptionTextBox.Text;
            string AmazonTaskKeywords    = AmazonTaskKeywordsTextBox.Text;
            double pricePerObject        = 0; //default
            int    numObjectPerImage     = 0; //default
            double price       = 0;           //default
            int    tasksPerHIT = 1;           //defuault



            if (AzureBlobStorageConnectionString == "" || AzureContainer == "")
            {
                Template_ErrorMessageLabel.Text      = "Error : Azure Connection String and Container are mandatory fields.";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }

            AzureConnectionInfo connectionInfo = new AzureConnectionInfo(AzureBlobStorageConnectionString, AzureContainer, AzureContainerDirectory);
            int noFiles = connectionInfo.getNoFiles();

            if (noFiles == -1)
            {
                Template_ErrorMessageLabel.Text      = "Error :  Invalid Azure Location";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }
            else if (noFiles == 0)
            {
                Template_ErrorMessageLabel.Text      = "Error :  There are 0 files at the Azure Location";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }

            if (Hidden_MechanicalTurk.Value == "true")
            {
                AmazonMTurkHIT hit     = new AmazonMTurkHIT();
                bool           success = hit.setAccount(AmazonAccessKeyIDValue, AmazonSecretAccessKeyIDValue, false);
                if (!success)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Invalid Amazon Turk Account";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
                double balance = hit.getAccountBalance();
                if (balance < 0)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Invalid Amazon Turk Account";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
                if (balance < 0.1)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Insufficient money in Amazon Turk Account";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
            }

            if (categories.Count == 0)
            {
                Template_ErrorMessageLabel.Text      = "Error :  There are no Categories";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }

            List <LineSegment> BoundaryLines = new List <LineSegment>();

            if (BoundaryTextBox.Text != "")
            {
                bool     error          = false;
                string   errorMessage   = "";
                string[] boundaryFields = BoundaryTextBox.Text.Split(',');
                for (int i = 0; i < boundaryFields.Length; i++)
                {
                    string[] coords = boundaryFields[i].Split('-');
                    if (coords.Length != 4)
                    {
                        errorMessage = "In Boundary String, Line No " + (i + 1) + " " + boundaryFields[i] + " : does not have 4 values.";
                        error        = true;
                        break;
                    }
                    int  x1, y1, x2, y2;
                    bool success = int.TryParse(coords[0], out x1);
                    if (!success)
                    {
                        errorMessage = "In Boundary String, Line No " + (i + 1) + " " + boundaryFields[i] + " : " + coords[0] + " must be an integer";
                        error        = true;
                        break;
                    }
                    success = int.TryParse(coords[1], out y1);
                    if (!success)
                    {
                        errorMessage = "In Boundary String, Line No " + (i + 1) + " " + boundaryFields[i] + " : " + coords[1] + " must be an integer";
                        error        = true;
                        break;
                    }
                    success = int.TryParse(coords[2], out x2);
                    if (!success)
                    {
                        errorMessage = "In Boundary String, Line No " + (i + 1) + " " + boundaryFields[i] + " : " + coords[2] + " must be an integer";
                        error        = true;
                        break;
                    }
                    success = int.TryParse(coords[3], out y2);
                    if (!success)
                    {
                        errorMessage = "In Boundary String, Line No " + (i + 1) + " " + boundaryFields[i] + " : " + coords[3] + " must be an integer";
                        error        = true;
                        break;
                    }
                    LineSegment ls = new LineSegment(x1, y1, x2, y2);
                    BoundaryLines.Add(ls);
                }
                if (error)
                {
                    Template_ErrorMessageLabel.Text      = errorMessage;
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
            }

            if (Hidden_MechanicalTurk.Value == "true")
            {
                bool success = Double.TryParse(PriceTextBox.Text, out pricePerObject);
                if (!success)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Non-numerical price entered";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
                pricePerObject = pricePerObject / 100; //covert to dollars
                success        = Int32.TryParse(NoObjectsPerImageTextBox.Text, out numObjectPerImage);
                if (!success)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Non-numerical number of objects per image entered";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }

                price = pricePerObject * numObjectPerImage;
                if (price <= 0.0)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  The Price is Zero";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }

                //need to round to cents
                price = Math.Floor(price * 100) / 100;

                AmazonMTurkHIT hit = new AmazonMTurkHIT();
                success = hit.setAccount(AmazonAccessKeyIDValue, AmazonSecretAccessKeyIDValue, false);
                if (!success)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Invalid Amazon Turk Account";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
                double balance = hit.getAccountBalance();
                if (balance < 0)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Invalid Amazon Turk Account";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }

                double moneyNeeded = 4 * price * noFiles / tasksPerHIT;
                if (balance < moneyNeeded)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Insufficient money in Amazon Turk Account, you will need atleast " + moneyNeeded + "$.";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }

                if (AmazonTaskTitle == "")
                {
                    Template_ErrorMessageLabel.Text = "Image Segmentation";
                }

                if (AmazonTaskTitle == "")
                {
                    Template_ErrorMessageLabel.Text = "Earn money quickly by drawing polygons around objects of interest in an image!";
                }

                if (AmazonTaskKeywords == "Image Segmentation")
                {
                    Template_ErrorMessageLabel.Text = "";
                }
            }

            AzureInformation AzureInfo = new AzureInformation();

            AzureInfo.AzureBlobStorageConnectionString       = AzureBlobStorageConnectionString;
            AzureInfo.AzureBlobStorageContainerName          = AzureContainer;
            AzureInfo.AzureBlobStorageContainerDirectoryName = AzureContainerDirectory;

            AmazonMTurkHITInformation AmazonInfo = new AmazonMTurkHITInformation();

            if (Hidden_MechanicalTurk.Value == "true")
            {
                AmazonInfo.AmazonAccessKeyID       = AmazonAccessKeyIDValue;
                AmazonInfo.AmazonSecretAccessKeyID = AmazonSecretAccessKeyIDValue;
                AmazonInfo.Price = price;
                AmazonInfo.AmazonMTurkTaskTitle       = AmazonTaskTitle;
                AmazonInfo.AmazonMTurkTaskDescription = AmazonTaskDescription;
                AmazonInfo.AmazonMTurkTaskKeywords    = AmazonTaskKeywords;
            }
            else
            {
                AmazonInfo.AmazonAccessKeyID       = "";
                AmazonInfo.AmazonSecretAccessKeyID = "";
                AmazonInfo.Price = 0;
                AmazonInfo.AmazonMTurkTaskTitle       = "";
                AmazonInfo.AmazonMTurkTaskDescription = "";
                AmazonInfo.AmazonMTurkTaskKeywords    = "";
            }

            ImageSegmentationSubmittedJob jobParameters = new ImageSegmentationSubmittedJob();

            jobParameters.Categories    = categories;
            jobParameters.Description   = Description;
            jobParameters.BoundaryLines = BoundaryLines;

            SatyamJob job = new SatyamJob();

            job.UserID = userName;
            job.amazonHITInformation = AmazonInfo;
            job.azureInformation     = AzureInfo;
            job.JobGUIDString        = jobGuid;
            if (Hidden_MechanicalTurk.Value == "true")
            {
                job.JobTemplateType = TaskConstants.Segmentation_Image_MTurk;
                job.TasksPerJob     = tasksPerHIT;
            }
            else
            {
                job.JobTemplateType = TaskConstants.Segmentation_Image;
                job.TasksPerJob     = 0;
            }
            job.JobSubmitTime = DateTime.Now;
            job.JobParameters = JSonUtils.ConvertObjectToJSon <ImageSegmentationSubmittedJob>(jobParameters);
            string jobDefinition = JSonUtils.ConvertObjectToJSon <SatyamJob>(job);

            SatyamJobSubmissionsTableAccess dbAccess = new SatyamJobSubmissionsTableAccess();

            dbAccess.AddEntry(job.JobTemplateType, job.UserID, job.JobGUIDString, jobDefinition, job.JobSubmitTime);
            dbAccess.close();
            Response.Redirect("NewJobSubmitted.aspx");
        }
Пример #7
0
        public static void CreateDemoJob_MULTI_OBJECT_LOCALIZATION_AND_LABLING()
        {
            //first Job
            SatyamJob job = new SatyamJob();

            AzureInformation AzureInfo = new AzureInformation();

            AzureInfo.AzureBlobStorageConnectionString       = SatyamJobStorageAccountAccess.connection_string;
            AzureInfo.AzureBlobStorageContainerName          = "demo";
            AzureInfo.AzureBlobStorageContainerDirectoryName = "catsAndDogs";

            AmazonMTurkHITInformation AmazonInfo = new AmazonMTurkHITInformation();


            MultiObjectLocalizationAndLabelingSubmittedJob template = new MultiObjectLocalizationAndLabelingSubmittedJob();
            List <string> categories = new List <string>()
            {
                "Cat", "Dog"
            };

            template.Categories    = categories;
            template.Description   = "";
            template.BoundaryLines = new List <LineSegment>();


            job.JobGUIDString        = "MULTI_OBJECT_LOCALIZATION_AND_LABLING_DEMO";
            job.amazonHITInformation = AmazonInfo;
            job.azureInformation     = AzureInfo;
            job.JobSubmitTime        = DateTime.Now;
            job.JobTemplateType      = "MULTI_OBJECT_LOCALIZATION_AND_LABLING_DEMO";
            job.UserID = TaskConstants.AdminName;


            job.JobParameters = JSonUtils.ConvertObjectToJSon <MultiObjectLocalizationAndLabelingSubmittedJob>(template);

            string JobParametersString = JSonUtils.ConvertObjectToJSon <SatyamJob>(job);

            SatyamJobSubmissionsTableAccess jobDB = new SatyamJobSubmissionsTableAccess();

            jobDB.AddEntry(job.JobTemplateType, job.UserID, job.JobGUIDString, JobParametersString, job.JobSubmitTime);


            //second job
            SatyamJob job1 = new SatyamJob();

            AzureInformation AzureInfo1 = new AzureInformation();

            AzureInfo1.AzureBlobStorageConnectionString       = SatyamJobStorageAccountAccess.connection_string;
            AzureInfo1.AzureBlobStorageContainerName          = "demo";
            AzureInfo1.AzureBlobStorageContainerDirectoryName = "TrafficExample-EastGate";

            AmazonMTurkHITInformation AmazonInfo1 = new AmazonMTurkHITInformation();


            MultiObjectLocalizationAndLabelingSubmittedJob template1 = new MultiObjectLocalizationAndLabelingSubmittedJob();
            List <string> categories1 = new List <string>()
            {
                "Vehicle", "Person"
            };

            template1.Categories    = categories1;
            template1.Description   = "Vehicles can be buses, cars, trucks, motorbikes but not bi-cylces or wheelchairs. Person can be pedestrian or a cylist.";
            template1.BoundaryLines = new List <LineSegment>();

            template1.BoundaryLines.Add(new LineSegment(1, 489, 291, 191));
            template1.BoundaryLines.Add(new LineSegment(291, 191, 435, 103));
            template1.BoundaryLines.Add(new LineSegment(435, 103, 664, 68));
            template1.BoundaryLines.Add(new LineSegment(664, 68, 883, 127));
            template1.BoundaryLines.Add(new LineSegment(883, 127, 915, 205));
            template1.BoundaryLines.Add(new LineSegment(915, 205, 1276, 497));
            template1.BoundaryLines.Add(new LineSegment(1276, 497, 1276, 694));
            template1.BoundaryLines.Add(new LineSegment(1276, 694, 1, 696));
            template1.BoundaryLines.Add(new LineSegment(1, 696, 1, 489));

            job1.JobGUIDString        = "MULTI_OBJECT_LOCALIZATION_AND_LABLING_DEMO";
            job1.amazonHITInformation = AmazonInfo1;
            job1.azureInformation     = AzureInfo1;
            job1.JobSubmitTime        = DateTime.Now;
            job1.JobTemplateType      = "MULTI_OBJECT_LOCALIZATION_AND_LABLING_DEMO";
            job1.UserID = TaskConstants.AdminName;

            job1.JobParameters = JSonUtils.ConvertObjectToJSon <MultiObjectLocalizationAndLabelingSubmittedJob>(template1);

            string JobParametersString1 = JSonUtils.ConvertObjectToJSon <SatyamJob>(job1);

            jobDB.AddEntry(job1.JobTemplateType, job1.UserID, job1.JobGUIDString, JobParametersString1, job1.JobSubmitTime);
            jobDB.close();
        }
Пример #8
0
        protected void Object_Counting_JobSubmitButton_Click(object sender, EventArgs e)
        {
            string AzureBlobStorageConnectionString = AzureBlobStorageConnectionStringTextBox.Text;
            string AzureContainer               = AzureBlobStorageContainerNameTextBox.Text;
            string AzureContainerDirectory      = AzureBlobStorageContainerDirectoryNameTextBox.Text;
            string AmazonAccessKeyIDValue       = AmazonAccessKeyID.Text;
            string AmazonSecretAccessKeyIDValue = AmazonSecretAccessKeyID.Text;
            string Description           = CategoryDescription.Text;
            double pricePerImage         = 0;
            double price                 = 0;
            string jobGuid               = NewJobGUID.Text;
            string AmazonTaskTitle       = AmazonTaskTitleTextBox.Text;
            string AmazonTaskDescription = AmazonTaskDescriptionTextBox.Text;
            string AmazonTaskKeywords    = AmazonTaskKeywordsTextBox.Text;

            if (AzureBlobStorageConnectionString == "" || AzureContainer == "")
            {
                Template_ErrorMessageLabel.Text      = "Error : Azure Connection String and Container are mandatory fields.";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }

            AzureConnectionInfo connectionInfo = new AzureConnectionInfo(AzureBlobStorageConnectionString, AzureContainer, AzureContainerDirectory);
            int noFiles = connectionInfo.getNoFiles();

            if (noFiles == -1)
            {
                Template_ErrorMessageLabel.Text      = "Error :  Invalid Azure Location";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }
            else if (noFiles == 0)
            {
                Template_ErrorMessageLabel.Text      = "Error :  There are 0 files at the Azure Location";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }

            if (Hidden_MechanicalTurk.Value == "true")
            {
                bool success = Double.TryParse(PriceTextBox.Text, out pricePerImage);
                if (!success)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Non-numerical price entered";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
                pricePerImage = pricePerImage / 100; //convert to dollars
                price         = pricePerImage * TaskConstants.OBJECT_COUNTING_MTURK_MAX_IMAGES_PER_TASK;

                //need to round to cents
                price = Math.Floor(price * 100) / 100;

                if (price <= 0.0)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  The Price is Zero";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
                AmazonMTurkHIT hit = new AmazonMTurkHIT();
                success = hit.setAccount(AmazonAccessKeyIDValue, AmazonSecretAccessKeyIDValue, false);
                if (!success)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Invalid Amazon Turk Account";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
                double balance = hit.getAccountBalance();
                if (balance < 0)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Invalid Amazon Turk Account";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
                double moneyNeeded = 4 * price * noFiles / TaskConstants.OBJECT_COUNTING_MTURK_MAX_IMAGES_PER_TASK;

                if (balance < moneyNeeded)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Insufficient money in Amazon Turk Account. You will need at least " + moneyNeeded + "$.";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }

                if (AmazonTaskTitle == "")
                {
                    Template_ErrorMessageLabel.Text = "Counting Objects in an Image";
                }

                if (AmazonTaskTitle == "")
                {
                    Template_ErrorMessageLabel.Text = "Earn money quickly by simply counting the number of objects of interest in an image!";
                }

                if (AmazonTaskKeywords == "Object Counting")
                {
                    Template_ErrorMessageLabel.Text = "";
                }
            }

            string objectName = ObjectNameTextBox.Text;

            if (objectName == "")
            {
                Template_ErrorMessageLabel.Text      = "Error :  No Object Name Entered";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }

            AzureInformation AzureInfo = new AzureInformation();

            AzureInfo.AzureBlobStorageConnectionString       = AzureBlobStorageConnectionString;
            AzureInfo.AzureBlobStorageContainerName          = AzureContainer;
            AzureInfo.AzureBlobStorageContainerDirectoryName = AzureContainerDirectory;


            AmazonMTurkHITInformation AmazonInfo = new AmazonMTurkHITInformation();

            if (Hidden_MechanicalTurk.Value == "true")
            {
                AmazonInfo.AmazonAccessKeyID       = AmazonAccessKeyIDValue;
                AmazonInfo.AmazonSecretAccessKeyID = AmazonSecretAccessKeyIDValue;
                AmazonInfo.Price = price; //in dollars
                AmazonInfo.AmazonMTurkTaskTitle       = AmazonTaskTitle;
                AmazonInfo.AmazonMTurkTaskDescription = AmazonTaskDescription;
                AmazonInfo.AmazonMTurkTaskKeywords    = AmazonTaskKeywords;
            }
            else
            {
                AmazonInfo.AmazonAccessKeyID       = "";
                AmazonInfo.AmazonSecretAccessKeyID = "";
                AmazonInfo.Price = 0;
                AmazonInfo.AmazonMTurkTaskTitle       = "";
                AmazonInfo.AmazonMTurkTaskDescription = "";
                AmazonInfo.AmazonMTurkTaskKeywords    = "";
            }

            ObjectCountingSubmittedJob jobParameters = new ObjectCountingSubmittedJob();

            jobParameters.ObjectName  = objectName;
            jobParameters.Description = Description;

            SatyamJob job = new SatyamJob();

            job.UserID = userName;
            job.amazonHITInformation = AmazonInfo;
            job.azureInformation     = AzureInfo;
            job.JobGUIDString        = jobGuid;
            if (Hidden_MechanicalTurk.Value == "true")
            {
                job.JobTemplateType = TaskConstants.Counting_Image_MTurk;
                job.TasksPerJob     = TaskConstants.OBJECT_COUNTING_MTURK_MAX_IMAGES_PER_TASK;
            }
            else
            {
                job.JobTemplateType = TaskConstants.Counting_Image;
                job.TasksPerJob     = 0;
            }
            job.JobSubmitTime = DateTime.Now;
            job.JobParameters = JSonUtils.ConvertObjectToJSon <ObjectCountingSubmittedJob>(jobParameters);

            if (Hidden_AdaptivePricing.Value == "true")
            {
                job.AdaptivePricing = true;
                bool success = Double.TryParse(TargetPricePerHourTextBox.Text, out job.TargetPricePerTask);
                if (!success)
                {
                    job.TargetPricePerTask = 13.56;           // default for now
                }
                success = Double.TryParse(BudgetTextBox.Text, out job.TotalBudget);
                if (!success)
                {
                    job.TotalBudget = -1;          //default
                }
            }
            else
            {
                job.AdaptivePricing    = false;
                job.TargetPricePerTask = -1;
                job.TotalBudget        = -1;
            }

            string jobDefinition = JSonUtils.ConvertObjectToJSon <SatyamJob>(job);

            SatyamJobSubmissionsTableAccess dbAccess = new SatyamJobSubmissionsTableAccess();

            dbAccess.AddEntry(job.JobTemplateType, job.UserID, job.JobGUIDString, jobDefinition, job.JobSubmitTime);
            dbAccess.close();
            Response.Redirect("NewJobSubmitted.aspx");
        }
Пример #9
0
        //protected void CategoryListBox_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    SubCategoryListBox.Items.Clear();
        //    string selectedItem = CategoryListBox.SelectedValue;
        //    List<string> items = subCategories[selectedItem];
        //    for (int i = 0; i < items.Count; i++)
        //    {
        //        ListItem item = new ListItem(items[i]);
        //        SubCategoryListBox.Items.Add(item);
        //    }
        //}

        //protected void AddSubCategoryButton_Click(object sender, EventArgs e)
        //{
        //    string category = CategoryListBox.SelectedValue;
        //    string newSubCategory = AddSubCategoryTextBox.Text;
        //    if (newSubCategory == "")
        //    {
        //        return;
        //    }
        //    else if (subCategories[category].Contains(newSubCategory))
        //    {
        //        return;
        //    }
        //    ListItem item = new ListItem(newSubCategory);
        //    SubCategoryListBox.Items.Add(item);
        //    AddSubCategoryTextBox.Text = "";
        //    subCategories[category].Add(newSubCategory);
        //    Hidden_SubCategories.Value = JSonUtils.ConvertObjectToJSon<Dictionary<String, List<String>>>(subCategories);
        //}

        //protected void DeleteSubCategoryButton_Click(object sender, EventArgs e)
        //{
        //    string category = CategoryListBox.SelectedValue;
        //    List<ListItem> subcategoriesToBeDeleted = new List<ListItem>();
        //    for (int i = 0; i < SubCategoryListBox.Items.Count; i++)
        //    {
        //        if (SubCategoryListBox.Items[i].Selected)
        //        {
        //            subcategoriesToBeDeleted.Add(SubCategoryListBox.Items[i]);
        //        }
        //    }
        //    for (int i = 0; i < subcategoriesToBeDeleted.Count; i++)
        //    {
        //        subCategories[category].Remove(subcategoriesToBeDeleted[i].Text);
        //        SubCategoryListBox.Items.Remove(subcategoriesToBeDeleted[i]);
        //    }
        //    Hidden_SubCategories.Value = JSonUtils.ConvertObjectToJSon<Dictionary<String, List<String>>>(subCategories);
        //}

        protected void JobSubmitButton_Click(object sender, EventArgs e)
        {
            string AzureBlobStorageConnectionString = AzureBlobStorageConnectionStringTextBox.Text;
            string AzureContainer               = AzureBlobStorageContainerNameTextBox.Text;
            string AzureContainerDirectory      = AzureBlobStorageContainerDirectoryNameTextBox.Text;
            string AmazonAccessKeyIDValue       = AmazonAccessKeyID.Text;
            string AmazonSecretAccessKeyIDValue = AmazonSecretAccessKeyID.Text;
            string Description           = CategoryDescription.Text;
            string jobGuid               = NewJobGUID.Text;
            string AmazonTaskTitle       = AmazonTaskTitleTextBox.Text;
            string AmazonTaskDescription = AmazonTaskDescriptionTextBox.Text;
            string AmazonTaskKeywords    = AmazonTaskKeywordsTextBox.Text;

            double pricePerObjectPerChunk = 0;
            int    noObjectsPerChunk      = 0;
            string FrameRate    = TargetFrameRate.Text;
            string chunkLength  = ChunkDuration.Text;
            string chunkOverlap = ChunkOverlap.Text;


            if (AzureBlobStorageConnectionString == "" || AzureContainer == "")
            {
                Template_ErrorMessageLabel.Text      = "Error : Azure Connection String and Container are mandatory fields.";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }

            AzureConnectionInfo connectionInfo = new AzureConnectionInfo(AzureBlobStorageConnectionString, AzureContainer, AzureContainerDirectory);
            int noFiles = connectionInfo.getNoFiles();

            if (noFiles == -1)
            {
                Template_ErrorMessageLabel.Text      = "Error :  Invalid Azure Location";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }
            else if (noFiles == 0)
            {
                Template_ErrorMessageLabel.Text      = "Error :  There are 0 files at the Azure Location";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }

            if (Hidden_MechanicalTurk.Value == "true")
            {
                AmazonMTurkHIT hit     = new AmazonMTurkHIT();
                bool           success = hit.setAccount(AmazonAccessKeyIDValue, AmazonSecretAccessKeyIDValue, false);
                if (!success)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Invalid Amazon Turk Account";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
                double balance = hit.getAccountBalance();
                if (balance < 0)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Invalid Amazon Turk Account";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
                if (balance < 0.1)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Insufficient money in Amazon Turk Account";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
            }

            if (subCategories.Count == 0)
            {
                Template_ErrorMessageLabel.Text      = "Error :  There are no Categories";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }

            List <LineSegment> BoundaryLines = new List <LineSegment>();

            if (BoundaryString.Text != "")
            {
                bool     error          = false;
                string   errorMessage   = "";
                string[] boundaryFields = BoundaryString.Text.Split(',');
                for (int i = 0; i < boundaryFields.Length; i++)
                {
                    string[] coords = boundaryFields[i].Split('-');
                    if (coords.Length != 4)
                    {
                        errorMessage = "In Boundary String, Line No " + (i + 1) + " " + boundaryFields[i] + " : does not have 4 values.";
                        error        = true;
                        break;
                    }
                    int  x1, y1, x2, y2;
                    bool success = int.TryParse(coords[0], out x1);
                    if (!success)
                    {
                        errorMessage = "In Boundary String, Line No " + (i + 1) + " " + boundaryFields[i] + " : " + coords[0] + " must be an integer";
                        error        = true;
                        break;
                    }
                    success = int.TryParse(coords[1], out y1);
                    if (!success)
                    {
                        errorMessage = "In Boundary String, Line No " + (i + 1) + " " + boundaryFields[i] + " : " + coords[1] + " must be an integer";
                        error        = true;
                        break;
                    }
                    success = int.TryParse(coords[2], out x2);
                    if (!success)
                    {
                        errorMessage = "In Boundary String, Line No " + (i + 1) + " " + boundaryFields[i] + " : " + coords[2] + " must be an integer";
                        error        = true;
                        break;
                    }
                    success = int.TryParse(coords[3], out y2);
                    if (!success)
                    {
                        errorMessage = "In Boundary String, Line No " + (i + 1) + " " + boundaryFields[i] + " : " + coords[3] + " must be an integer";
                        error        = true;
                        break;
                    }
                    LineSegment ls = new LineSegment(x1, y1, x2, y2);
                    BoundaryLines.Add(ls);
                }
                if (error)
                {
                    Template_ErrorMessageLabel.Text      = errorMessage;
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
            }

            if (Hidden_MechanicalTurk.Value == "true")
            {
                bool success = Double.TryParse(PriceTextBox.Text, out pricePerObjectPerChunk);
                if (!success)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Non-numerical price entered";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
                pricePerObjectPerChunk = pricePerObjectPerChunk / 100; //covert to dollars
                success = Int32.TryParse(NoObjectsPerChunkTextBox.Text, out noObjectsPerChunk);
                if (!success)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Non-numerical number of objects per image entered";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }

                if (pricePerObjectPerChunk <= 0.0)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Illegal Price";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
                if (noObjectsPerChunk <= 0.0)
                {
                    Template_ErrorMessageLabel.Text      = "Error :  Illegal number of objects";
                    Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                    Template_ErrorMessageLabel.Font.Bold = true;
                    return;
                }
            }

            if (!InputFormatImage.Checked && !InputFormatVideo.Checked)
            {
                Template_ErrorMessageLabel.Text      = "Error :  Please select input format";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }

            if (Convert.ToDouble(FrameRate) <= 0)
            {
                Template_ErrorMessageLabel.Text      = "Error :  Invalid Target Frame Rate";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }

            if (Convert.ToInt32(chunkLength) <= 0)
            {
                Template_ErrorMessageLabel.Text      = "Error :  Invalid Chunk Duration";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }
            if (Convert.ToDouble(chunkOverlap) <= 0 || Convert.ToDouble(chunkOverlap) > Convert.ToInt32(chunkLength) / 2)
            {
                Template_ErrorMessageLabel.Text      = "Error :  Invalid Chunk Overlap, must be in (0,Chunk/2]";
                Template_ErrorMessageLabel.ForeColor = System.Drawing.Color.Red;
                Template_ErrorMessageLabel.Font.Bold = true;
                return;
            }


            AzureInformation AzureInfo = new AzureInformation();

            AzureInfo.AzureBlobStorageConnectionString       = AzureBlobStorageConnectionString;
            AzureInfo.AzureBlobStorageContainerName          = AzureContainer;
            AzureInfo.AzureBlobStorageContainerDirectoryName = AzureContainerDirectory;

            AmazonMTurkHITInformation AmazonInfo = new AmazonMTurkHITInformation();

            if (Hidden_MechanicalTurk.Value == "true")
            {
                AmazonInfo.AmazonAccessKeyID       = AmazonAccessKeyIDValue;
                AmazonInfo.AmazonSecretAccessKeyID = AmazonSecretAccessKeyIDValue;
                AmazonInfo.Price = Math.Floor(pricePerObjectPerChunk * (double)noObjectsPerChunk * 100) / 100;
                AmazonInfo.AmazonMTurkTaskTitle       = AmazonTaskTitle;
                AmazonInfo.AmazonMTurkTaskDescription = AmazonTaskDescription;
                AmazonInfo.AmazonMTurkTaskKeywords    = AmazonTaskKeywords;
            }
            else
            {
                AmazonInfo.AmazonAccessKeyID       = "";
                AmazonInfo.AmazonSecretAccessKeyID = "";
                AmazonInfo.Price = 0;
                AmazonInfo.AmazonMTurkTaskTitle       = "";
                AmazonInfo.AmazonMTurkTaskDescription = "";
                AmazonInfo.AmazonMTurkTaskKeywords    = "";
            }

            MultiObjectTrackingSubmittedJob jobParameters = new MultiObjectTrackingSubmittedJob();

            jobParameters.Categories    = subCategories;
            jobParameters.Description   = Description;
            jobParameters.BoundaryLines = BoundaryLines;

            jobParameters.FrameRate     = Convert.ToInt32(FrameRate);
            jobParameters.ChunkDuration = Convert.ToInt32(chunkLength);
            jobParameters.ChunkOverlap  = Convert.ToDouble(chunkOverlap);


            if (InputFormatVideo.Checked)
            {
                jobParameters.DataSrcFormat = Constants.DataFormat.Video;
            }
            else if (InputFormatImage.Checked)
            {
                jobParameters.DataSrcFormat = Constants.DataFormat.VideoFrame;
            }


            SatyamJob job = new SatyamJob();

            job.UserID = userName;
            job.amazonHITInformation = AmazonInfo;
            job.azureInformation     = AzureInfo;
            job.JobGUIDString        = jobGuid;
            if (Hidden_MechanicalTurk.Value == "true")
            {
                job.JobTemplateType = TaskConstants.Tracking_MTurk;
                job.TasksPerJob     = 1;
            }
            else
            {
                job.JobTemplateType = TaskConstants.Tracking;
                job.TasksPerJob     = 0;
            }
            job.JobSubmitTime = DateTime.Now;
            job.JobParameters = JSonUtils.ConvertObjectToJSon <MultiObjectTrackingSubmittedJob>(jobParameters);
            string jobDefinition = JSonUtils.ConvertObjectToJSon <SatyamJob>(job);

            SatyamJobSubmissionsTableAccess dbAccess = new SatyamJobSubmissionsTableAccess();

            dbAccess.AddEntry(job.JobTemplateType, job.UserID, job.JobGUIDString, jobDefinition, job.JobSubmitTime);
            dbAccess.close();
            Response.Redirect("NewJobSubmitted.aspx");
        }