CSA-AI / CSA_AI

0 stars 0 forks source link

AP Week and Big Project 3 Plans #14

Open JishnuS420 opened 6 months ago

JishnuS420 commented 6 months ago

RDS and SQLite Legacy Challenge:

Big Project:

For the big project, a large majority of the backend is completed and the key features are primarily done apart from things for the leaderboard and other aparts of the stock game and so, the frontend is the primary focus now.

Links to individual issues are highlighted in blue.

Features

Ethan T

Our backend has...

Hand Recognition Generalization

Improve accuracy of the model (further training of the model for accuracy) OpenCV's bounding box capabilities rely solely on geometric properties and the pixels taken from the frontend in the bounded area. Through Generalization, the hand's appearance in different environments such as lighting.

Timeline

    // method to create variations of an image
    private BufferedImage[] createAugmentedImages(BufferedImage originalImage) throws IOException {
        BufferedImage[] augmentedImages = new BufferedImage[9]; // array size remains 9 for 9 variations
        augmentedImages[0] = originalImage; // first image remains unchanged
        augmentedImages[1] = changeBrightness(originalImage, 0.8f); // decrease brightness by 20%
        augmentedImages[2] = changeBrightness(originalImage, 1.2f); // increase brightness by 20%
        augmentedImages[3] = addNoise(originalImage, 0.1); // add low level of noise
        augmentedImages[4] = addNoise(originalImage, 0.2); // add higher level of noise
        augmentedImages[5] = adjustHue(originalImage); // randomly adjust hue
        augmentedImages[6] = rotateImage(originalImage, 30); // rotate image by 30 degrees
        augmentedImages[7] = flipImage(originalImage, true); // flip image horizontally
        augmentedImages[8] = flipImage(originalImage, false); // flip image vertically

        // save each augmented image to a file using i+1 as filename
        for (int i = 0; i < augmentedImages.length; i++) {
            saveImage(augmentedImages[i], "augmented_image_" + (i + 1) + ".png");
        }

        return augmentedImages;
    }    

    // method to change brightness of an image
    private BufferedImage changeBrightness(BufferedImage image, float factor) {
        BufferedImage newImage = new BufferedImage(image.getWidth(), image.getHeight(), image.getType());
        Graphics2D g = newImage.createGraphics();
        g.drawImage(image, 0, 0, null);
        g.dispose();

        // adjust brightness for each pixel
        for (int y = 0; y < newImage.getHeight(); y++) {
            for (int x = 0; x < newImage.getWidth(); x++) {
                int rgba = newImage.getRGB(x, y);
                int alpha = (rgba >> 24) & 0xff;
                int red = (int)Math.min(255, ((rgba >> 16) & 0xff) * factor);
                int green = (int)Math.min(255, ((rgba >> 8) & 0xff) * factor);
                int blue = (int)Math.min(255, (rgba & 0xff) * factor);
                newImage.setRGB(x, y, (alpha << 24) | (red << 16) | (green << 8) | blue);
            }
        }
        return newImage;
    }

    // method to add noise to an image
    private BufferedImage addNoise(BufferedImage image, double noiseLevel) {
        BufferedImage newImage = new BufferedImage(image.getWidth(), image.getHeight(), image.getType());
        Graphics2D g = newImage.createGraphics();
        g.drawImage(image, 0, 0, null);
        g.dispose();

        // add noise to each pixel
        for (int y = 0; y < newImage.getHeight(); y++) {
            for (int x = 0; x < newImage.getWidth(); x++) {
                int rgba = newImage.getRGB(x, y);
                int alpha = (rgba >> 24) & 0xff;
                int red = (int)Math.min(255, Math.max(0, (int)(((rgba >> 16) & 0xff) * (1 + (Math.random() - 0.5) * noiseLevel))));
                int green = (int)Math.min(255, Math.max(0, (int)(((rgba >> 8) & 0xff) * (1 + (Math.random() - 0.5) * noiseLevel))));
                int blue = (int)Math.min(255, Math.max(0, (int)((rgba & 0xff) * (1 + (Math.random() - 0.5) * noiseLevel))));
                newImage.setRGB(x, y, (alpha << 24) | (red << 16) | (green << 8) | blue);
            }
        }
        return newImage;
    }

    // method to adjust hue of an image
    private BufferedImage adjustHue(BufferedImage image) {
        BufferedImage newImage = new BufferedImage(image.getWidth(), image.getHeight(), image.getType());
        Graphics2D g = newImage.createGraphics();
        g.drawImage(image, 0, 0, null);
        g.dispose();

        // adjust hue for each pixel
        for (int y = 0; y < newImage.getHeight(); y++) {
            for (int x = 0; x < newImage.getWidth(); x++) {
                int rgba = newImage.getRGB(x, y);
                int alpha = (rgba >> 24) & 0xff;
                int red = Math.min(255, (int)(((rgba >> 16) & 0xff) * (0.8 + Math.random() * 0.4)));
                int green = Math.min(255, (int)(((rgba >> 8) & 0xff) * (0.8 + Math.random() * 0.4)));
                int blue = Math.min(255, (int)((rgba & 0xff) * (0.8 + Math.random() * 0.4)));
                newImage.setRGB(x, y, (alpha << 24) | (red << 16) | (green << 8) | blue);
            }
        }
        return newImage;
    }

    // method to rotate an image
    private BufferedImage rotateImage(BufferedImage image, double angle) {
        // create a transformation matrix for rotating the image
        AffineTransform tx = new AffineTransform();
        tx.rotate(Math.toRadians(angle), image.getWidth() / 2.0, image.getHeight() / 2.0);

        // apply the transformation to the image
        AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR);
        return op.filter(image, null);
    }

    // method to flip an image horizontally or vertically
    private BufferedImage flipImage(BufferedImage image, boolean horizontal) {
        // create a transformation matrix for flipping the image
        AffineTransform tx = new AffineTransform();
        if (horizontal) {
            tx.scale(-1, 1); // flip horizontally
            tx.translate(-image.getWidth(), 0);
        } else {
            tx.scale(1, -1); // flip vertically
            tx.translate(0, -image.getHeight());
        }

        // apply the transformation to the image
        AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
        return op.filter(image, null);
    }
    private List<List<List<Integer>>> generateAugmentedFrames(String imageData) throws IOException {
        byte[] imageBytes = Base64.getDecoder().decode(imageData);
        ByteArrayInputStream bis = new ByteArrayInputStream(imageBytes);
        BufferedImage originalImage = ImageIO.read(bis);

        List<List<List<Integer>>> mnistDataList = new ArrayList<>();
        BufferedImage[] augmentedImages = createAugmentedImages(originalImage);

        for (BufferedImage image : augmentedImages) {
            mnistDataList.add(convertToMNIST(image));
        }

        return mnistDataList;
    }

Krishiv

LeaderBoard Key Features


Backend

Working Feature

USE OF SORTING IN THE ITTERATOR

Screenshot 2024-05-29 at 8 44 12 AM

SQL IMPLEMENTATION

Screenshot 2024-05-29 at 8 43 33 AM

POSTMAN REQUESTS

FRONTEND FETCH AND WORKING TABLE!

fe

ERRORS THAT WERE FACED!

  1. POM.XML; with working on different versions, since everyones codebase was constantly changing using wrong headers and imports often left dependencies to fail and build not working in the front-end, however this was fixed through better communication and better branch management. Screenshot 2024-05-28 at 7 02 04 PM

Image 5-28-24 at 7 00 PM

  1. Being able to have test data: every time we tried to make a postman request to post new data and later on make a get request so that it sorted the list by a specified attribute, we would get some sort of error, such as a 405 Not Allowed error or even an Internal Server Error. Later on, however, we found that this was because we were missing PostMapping in our API controller for the performance leaderboard, so we added that along with a new endpoint so that it could create new users. Now we are able to add users to the list along with their other attributes.

image (used the wrong endpoint and format when adding the data)

Jishnu

Things to tend to:

Live Stats page (primary priority):

Prediction page (primary priority):

Stock Game page (secondary priority, cannot be implmented without the above):

Timeline and CheckPoints:

akshat122805 commented 5 months ago

Team Features

Individal Features

Takeaways

rohinsood commented 5 months ago

Ethan Z

VishnuAravind12 commented 5 months ago

David

Ethan

Jishnu

Alex

Emaad

Krishiv

Ethan Z.

Takeaways

vardaansinha commented 5 months ago
  1. David Vasilev
  1. Ethan Tran
  1. Jishnu
  1. Alex L
  1. Krishiv
  1. Ethan Z

TEAM:

  1. Deployment, a full deployment of frontend and backend

    • [x] Key features must be deployed in order to be presented, localhost presentations are .55
    • [x] Multiple people need to be able to interact with features at the same time, data updates
  2. Searching/Sorting, 2 features must support searching and sorting from backend,

    • [x] 1 feature should have JPA build in sorting,
    • [x] 1 features should perform custom sort after retrieving backend data
    • [x] Extra. A feature that utilizes Stacks or Queues for ordering
Tirth-Thakkar commented 5 months ago

David:

Alex:

Jishnu:

Anthony:

Emaad:

Ethan

Krishiv:

James

Yuri

Tay

Presentation

h4seeb-cmd commented 5 months ago

David

Jishnu:

Alex:

Emaad:

Krishiv:

Ethan Tran:

Ethan Zhao:

Presentation Grows:

Henerystone commented 5 months ago

David login and sign up feature. problems with sign in functionality interesting application of creativity with the server but dashboard did not work

Ethan biometric login seemed interesting and everything seemed functional

Jishnu Research stock had nice UI. Fully functional graph seems easy to use. Use of multiple API

Alex interesting feature dual language usage is interesting too interesting graphing

Emaad Created a Stock dashboard, good use of CSS and staying looks good

Krishiv Iterator and Collectable for user ratings not able demo this?

Ethan Z. AWS documentation The RDS implemetation

Takeaways showcase of too many features, lower the amount and set aside ones that don't work

Pitsco commented 5 months ago

Giggle Juice's Reflection based on Kaiden, Derrick, and Nikhil's review

Notes

Final Grade: 11/12