{"id":26870799,"url":"https://github.com/shreyansh-21/hateshield","last_synced_at":"2026-05-17T09:39:48.681Z","repository":{"id":285332690,"uuid":"957480112","full_name":"shreyansh-21/HateShield","owner":"shreyansh-21","description":"HateShield is an AI-powered hate speech detection system using LSTM for text and ResNet for images. It analyzes social media comments, memes, and other content to identify harmful speech with high accuracy.","archived":false,"fork":false,"pushed_at":"2025-03-31T04:54:35.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T05:27:48.201Z","etag":null,"topics":["ai","computer-vision","deep-learning","hate-speech-detection","keras","machine-learning","nlp","tenserflow"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shreyansh-21.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-30T13:35:10.000Z","updated_at":"2025-03-31T05:02:23.000Z","dependencies_parsed_at":"2025-03-31T05:37:59.725Z","dependency_job_id":null,"html_url":"https://github.com/shreyansh-21/HateShield","commit_stats":null,"previous_names":["shreyansh-21/hateshield"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shreyansh-21%2FHateShield","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shreyansh-21%2FHateShield/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shreyansh-21%2FHateShield/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shreyansh-21%2FHateShield/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shreyansh-21","download_url":"https://codeload.github.com/shreyansh-21/HateShield/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246429494,"owners_count":20775808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","computer-vision","deep-learning","hate-speech-detection","keras","machine-learning","nlp","tenserflow"],"created_at":"2025-03-31T07:17:10.806Z","updated_at":"2025-10-20T03:02:30.990Z","avatar_url":"https://github.com/shreyansh-21.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003eHateShield\u003c/h1\u003e\n\u003ch2\u003eOverview\u003c/h2\u003e\n\u003cp\u003e\u003cstrong\u003eHateShield\u003c/strong\u003e is a deep learning-based system designed to detect hate speech in both text and images. It utilizes:\u003c/p\u003e\n\u003cul\u003e\n    \u003cli\u003e\u003cstrong\u003eLSTM (Long Short-Term Memory)\u003c/strong\u003e for analyzing text-based hate speech.\u003c/li\u003e\n    \u003cli\u003e\u003cstrong\u003eResNet (Residual Neural Networks)\u003c/strong\u003e for detecting hate content in memes and images.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eThis repository contains the implementation of both models, trained on multiple hate speech datasets.\u003c/p\u003e\n\n\u003chr\u003e\n\n\u003ch2\u003eTable of Contents\u003c/h2\u003e\n\u003col\u003e\n    \u003cli\u003e\u003ca href=\"#datasets\"\u003eDatasets\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#lstm\"\u003eLSTM for Text-Based Hate Speech Detection\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#resnet\"\u003eResNet for Image-Based Hate Speech Detection\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#run\"\u003eHow to Run\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#results\"\u003eResults\u003c/a\u003e\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003chr\u003e\n\n\u003ch2 id=\"datasets\"\u003eDatasets\u003c/h2\u003e\n\u003ch3\u003eText-Based Datasets\u003c/h3\u003e\n\u003cul\u003e\n    \u003cli\u003e\u003cstrong\u003eHateXplain\u003c/strong\u003e: A dataset that provides explanations along with hate speech classification.\u003c/li\u003e\n    \u003cli\u003eDataset Location: \u003ca href=\"https://huggingface.co/datasets/HateXplain\"\u003eHugging Face\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003cstrong\u003eTwitter \u0026 YouTube Hate Comments Dataset\u003c/strong\u003e: Contains hate speech from social media platforms.\u003c/li\u003e\n    \u003cli\u003eDataset Location: \u003ca href=\"https://www.kaggle.com/datasets\"\u003eKaggle\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ch3\u003eImage-Based Datasets\u003c/h3\u003e\n\u003cul\u003e\n    \u003cli\u003e\u003cstrong\u003eHateful Memes Dataset\u003c/strong\u003e: A multimodal dataset for hate speech detection in memes.\u003c/li\u003e\n    \u003cli\u003eDataset Location: \u003ca href=\"https://ai.facebook.com/datasets/hateful-memes\"\u003eFacebook AI\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003chr\u003e\n\n\u003ch2 id=\"lstm\"\u003eLSTM for Text-Based Hate Speech Detection\u003c/h2\u003e\n\u003ch3\u003eWhat is LSTM?\u003c/h3\u003e\n\u003cp\u003e\u003cstrong\u003eLSTM (Long Short-Term Memory)\u003c/strong\u003e is a type of recurrent neural network (RNN) that is particularly useful for processing sequential data, such as text. Unlike traditional RNNs, LSTMs can handle long-range dependencies, making them effective in understanding the context of words in sentences.\u003c/p\u003e\n\n\u003ch3\u003eHow LSTM Helps in Text Analysis\u003c/h3\u003e\n\u003cul\u003e\n    \u003cli\u003e\u003cstrong\u003eCaptures Context\u003c/strong\u003e: LSTMs remember words from earlier in a sentence, making them ideal for detecting implicit hate speech.\u003c/li\u003e\n    \u003cli\u003e\u003cstrong\u003eHandles Long Sequences\u003c/strong\u003e: Works well with long tweets, comments, and posts where context is crucial.\u003c/li\u003e\n    \u003cli\u003e\u003cstrong\u003eMitigates Vanishing Gradient Problem\u003c/strong\u003e: Unlike simple RNNs, LSTMs use gates to selectively store and forget information.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ch3\u003eImplementation Details\u003c/h3\u003e\n\u003cul\u003e\n    \u003cli\u003e\u003cstrong\u003ePreprocessing\u003c/strong\u003e:\n        \u003cul\u003e\n            \u003cli\u003eTokenization of text.\u003c/li\u003e\n            \u003cli\u003eRemoval of stop words and special characters.\u003c/li\u003e\n            \u003cli\u003ePadding sequences for uniform input size.\u003c/li\u003e\n        \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\u003cstrong\u003eModel Architecture\u003c/strong\u003e:\n        \u003cul\u003e\n            \u003cli\u003eEmbedding Layer: Converts words into dense vectors.\u003c/li\u003e\n            \u003cli\u003eLSTM Layer: Captures sequential dependencies.\u003c/li\u003e\n            \u003cli\u003eDense Layer: Classifies text as hateful or non-hateful.\u003c/li\u003e\n        \u003c/ul\u003e\n    \u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003e\u003cstrong\u003eCode Reference:\u003c/strong\u003e Check the \u003ccode\u003eText_LSTM.ipynb\u003c/code\u003e file for full implementation.\u003c/p\u003e\n\n\u003chr\u003e\n\n\u003ch2 id=\"resnet\"\u003eResNet for Image-Based Hate Speech Detection\u003c/h2\u003e\n\u003ch3\u003eWhat is ResNet?\u003c/h3\u003e\n\u003cp\u003e\u003cstrong\u003eResNet (Residual Networks)\u003c/strong\u003e is a deep convolutional neural network (CNN) architecture that introduces residual learning to solve the problem of vanishing gradients in deep networks. It allows for efficient training of very deep models.\u003c/p\u003e\n\n\u003ch3\u003eHow ResNet Helps in Image Analysis\u003c/h3\u003e\n\u003cul\u003e\n    \u003cli\u003e\u003cstrong\u003eFeature Extraction\u003c/strong\u003e: Detects text, symbols, and offensive imagery in memes.\u003c/li\u003e\n    \u003cli\u003e\u003cstrong\u003eDeep Learning Performance\u003c/strong\u003e: Prevents degradation in accuracy as networks get deeper.\u003c/li\u003e\n    \u003cli\u003e\u003cstrong\u003eResidual Connections\u003c/strong\u003e: Helps in learning more complex patterns compared to traditional CNNs.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ch3\u003eImplementation Details\u003c/h3\u003e\n\u003cul\u003e\n    \u003cli\u003e\u003cstrong\u003ePreprocessing\u003c/strong\u003e:\n        \u003cul\u003e\n            \u003cli\u003eImage resizing and normalization.\u003c/li\u003e\n            \u003cli\u003eData augmentation to improve model generalization.\u003c/li\u003e\n        \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\u003cstrong\u003eModel Architecture\u003c/strong\u003e:\n        \u003cul\u003e\n            \u003cli\u003eConvolutional Layers: Extracts features from images.\u003c/li\u003e\n            \u003cli\u003eResidual Blocks: Helps in deeper learning without vanishing gradients.\u003c/li\u003e\n            \u003cli\u003eFully Connected Layers: Classifies images as hateful or non-hateful.\u003c/li\u003e\n        \u003c/ul\u003e\n    \u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003e\u003cstrong\u003eCode Reference:\u003c/strong\u003e Check the \u003ccode\u003eResNet_final.ipynb\u003c/code\u003e file for full implementation.\u003c/p\u003e\n\n\u003chr\u003e\n\n\u003ch2 id=\"run\"\u003eHow to Run\u003c/h2\u003e\n\u003ch3\u003ePrerequisites\u003c/h3\u003e\n\u003cul\u003e\n    \u003cli\u003ePython 3.8+\u003c/li\u003e\n    \u003cli\u003eTensorFlow\u003c/li\u003e\n    \u003cli\u003eKeras\u003c/li\u003e\n    \u003cli\u003eOpenCV\u003c/li\u003e\n    \u003cli\u003ePandas\u003c/li\u003e\n    \u003cli\u003escikit-learn\u003c/li\u003e\n    \u003cli\u003eMatplotlib\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ch3\u003eSteps to Run\u003c/h3\u003e\n\u003col\u003e\n    \u003cli\u003eClone the repository:\n        \u003cpre\u003e\u003ccode\u003egit clone https://github.com/shreyansh-21/HateShield.git\ncd HateShield\u003c/code\u003e\u003c/pre\u003e\n    \u003c/li\u003e\n    \u003cli\u003eInstall dependencies:\n        \u003cpre\u003e\u003ccode\u003epip install -r requirements.txt\u003c/code\u003e\u003c/pre\u003e\n    \u003c/li\u003e\n    \u003cli\u003eRun the LSTM model:\n        \u003cpre\u003e\u003ccode\u003ejupyter notebook\n# Open and run Text_LSTM.ipynb\u003c/code\u003e\u003c/pre\u003e\n    \u003c/li\u003e\n    \u003cli\u003eRun the ResNet model:\n        \u003cpre\u003e\u003ccode\u003ejupyter notebook\n# Open and run ResNet_final.ipynb\u003c/code\u003e\u003c/pre\u003e\n    \u003c/li\u003e\n\u003c/ol\u003e\n\n\u003chr\u003e\n\n\u003ch2 id=\"results\"\u003eResults\u003c/h2\u003e\n\u003cp\u003eThe models achieve the following performance metrics:\u003c/p\u003e\n\u003cul\u003e\n    \u003cli\u003e\u003cstrong\u003eLSTM Model\u003c/strong\u003e:\n        \u003cul\u003e\n            \u003cli\u003ePrecision: \u003cstrong\u003e96%\u003c/strong\u003e\u003c/li\u003e\n            \u003cli\u003eRecall: \u003cstrong\u003e99%\u003c/strong\u003e\u003c/li\u003e\n            \u003cli\u003eF1-score: \u003cstrong\u003e96%\u003c/strong\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\u003cstrong\u003eResNet Model\u003c/strong\u003e:\n        \u003cul\u003e\n            \u003cli\u003eAccuracy: \u003cstrong\u003e97%\u003c/strong\u003e\u003c/li\u003e\n        \u003c/ul\u003e\n    \u003c/li\u003e\n\u003c/ul\u003e\n\u003chr\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshreyansh-21%2Fhateshield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshreyansh-21%2Fhateshield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshreyansh-21%2Fhateshield/lists"}