Commit c998429c authored by Rohan  Kumar's avatar Rohan Kumar
Browse files

fixing server

parent 75250c69
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <exec.mainClass>top.EntryPoint</exec.mainClass>
        <exec.mainClass>top.BackendJava</exec.mainClass>
    </properties>

    <!-- FOR THE YOLO USAGE:
+8 −4
Original line number Diff line number Diff line
@@ -13,8 +13,15 @@ import java.util.Scanner;

public class ObjectDetector {

    public static ObjectSet process(String bbox_dir_pth, String feat_dir_pth) throws FileNotFoundException {

    public static void startProcess() throws FileNotFoundException {

        // for now, we can just set paths to the directories that hold keyframes and featurepoint CSVs
        String feat_dir_pth = "src/main/java/vslam/KeyFramePoints";
        String keyframe_png_path = "src/main/java/vslam/KeyFrames";
        String bbox_dir_pth = "src/main/java/vslam/BoundedInfo";

        // get files
        File[] feat_CSVs = getDirFiles(feat_dir_pth);
        File[] bbox_CSVs = getDirFiles(bbox_dir_pth);

@@ -33,9 +40,6 @@ public class ObjectDetector {
            // single KeyFrame
            //ArrayList<ArrayList<Point>> currFrame = objSet.processFrame(feat_CSVs[i], bbox_CSVs[i]);
        }

        // return the completely built object set
        return objSet;
    }

    public static File[] getDirFiles(String dir_pth){
+20 −1
Original line number Diff line number Diff line
package top;

import object_detection.ObjectDetector;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.FileNotFoundException;

@SpringBootApplication
public class BackendJava {

    @Controller
    public class BackendService {
    public static class BackendService {

        @RequestMapping("/")
        public String index(){
            return "index";
        }

        @RequestMapping("/runProcess")
        public boolean runProcess() throws FileNotFoundException {

            ObjectDetector.startProcess();
            return true;
        }

    }

    public static void main(String[] args) {
        System.out.println("***********************************************");
        System.out.println("{ Running group8's project }");
        System.out.println("***********************************************");
        SpringApplication.run(BackendJava.class, args);
        System.out.println(" ============> GUI/Backend Server has been started on https://localhost:"+ 5555 + ".");
        System.out.println(" ============> Now, use the GUI to interact with the example.");
        System.out.println("***********************************************");
        System.out.println("{ Project completed with success. Hope you enjoyed. }");
        System.out.println("***********************************************");

    }

}

src/main/java/top/EntryPoint.java

deleted100644 → 0
+0 −105
Original line number Diff line number Diff line
package top;

import database.DatabaseUpdater;
import object_detection.ObjectDetector;
import object_detection.types.ObjectSet;
import org.springframework.boot.SpringApplication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.io.FileNotFoundException;

public class EntryPoint {

    public static void main(String[] args) throws FileNotFoundException {

        System.out.println("***********************************************");
        System.out.println("{ Running group8's project }");
        System.out.println("***********************************************");

        // #################################################
        // 1) Starting the GUI Server
        // #################################################


        // nothing yet
        int gui_port = 9999;

        System.out.println(" ============> 1) GUI Server has been started on https://localhost:"+ gui_port + ".");



        // #################################################
        // 2) Starting the Backend Java Server
        // #################################################


        // starts the application specified by BackendJava, which runs the system
        BackendJava.main(args);
        System.out.println(" ============> 2) GUI Server has been started on https://localhost:"+ 5555 + ".");


        // #################################################
        // 2) Getting keyframes and feature points
        // #################################################


        // for now, we can just set paths to the directories that hold keyframes and featurepoint CSVs
        String feature_csv_path = "src/main/java/vslam/KeyFramePoints";
        String keyframe_png_path = "src/main/java/vslam/KeyFrames";

        System.out.println(" ============> 3) Keyframe and Features have been collected.");


        // #################################################
        // 3) Get objects from keyframes
        // #################################################


        // for now, we can just set paths to the directories holding bounded box information
        String bounding_info_path = "src/main/java/vslam/BoundedInfo";

        System.out.println(" ============> 4) Objects have been detected via YOLOv4.");


        // #################################################
        // 4) Get objects from keyframes
        // #################################################

        // start the object detection module, output will be the objects pushed to the cloud, return the completed object set
        ObjectSet os = ObjectDetector.process(bounding_info_path, feature_csv_path);
        System.out.println(" ============> 5) ObjectSet has been constructed.");


        // #################################################
        // 5) Update database with objectset
        // #################################################


        // perform the update of the database using the video elements
        boolean updateRes = DatabaseUpdater.updateDB(os);
        if(!updateRes){
            System.err.println("ERROR: database update failed");
        }

        // let GUI server know that backend processing is complete
        System.out.println(" ============> 6) Database has been constructed.");

        // #################################################
        // 6) Ping GUI server with completion status, so server can start displaying ObjectSet
        // #################################################

        // nothing yet

        System.out.println(" ============> 7) GUI will start reflecting object tracking.");



        /*
        At this point, everything is done, but there should be the option to rerun this system with another video possibly?
         */
        System.out.println("***********************************************");
        System.out.println("{ Project completed with success. Hope you enjoyed. }");
        System.out.println("***********************************************");
    }
}
+0 −2
Original line number Diff line number Diff line
server.port = 5555
#spring.data.mongodb.uri = mongodb+srv://zanem:<YXQiSFkSVqxPTs3M>@cluster0.axhv9kg.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0
 No newline at end of file
Loading