IngreScan is an integrated solution that leverages AI and blockchain technology to automate ingredient detection and ensure compliance within the beverage supply chain. The project combines an AI-based ingredient detection system with a decentralized supply chain management system, providing transparency and traceability from raw material suppliers to retailers.
IngreScan consists of two main components:
-
AI-Powered Ingredient Detection: This component utilizes Optical Character Recognition (OCR) and image processing to extract ingredient information from product labels, ensuring that they meet safety standards and regulations.
-
Cold Drink Supply Chain Smart Contract: This Ethereum-based smart contract tracks the flow of cold drinks through various stages of the supply chain, providing a secure and transparent way to manage suppliers, manufacturers, distributors, and retailers.
- OCR and Image Processing: Extracts ingredients from product labels using OpenCV and Tesseract OCR
- Banned Substances Detection: Flags ingredients on a predefined banned list and monitors them against safety thresholds
- Real-Time Alerts: Notifies users of any compliance violations with clear labeling as "Exceeded" or "Banned"
- Data Storage: Saves extracted ingredient lists and compliance status as JSON files for further analysis
- Decentralized Tracking: Uses blockchain technology to track cold drinks from raw material suppliers to retailers
- Role Management: Only the contract owner can authorize suppliers, manufacturers, distributors, and retailers
- Stage Tracking: Monitors each cold drink's progress through stages such as Raw Material Supply, Manufacture, Distribution, and Retail
- Data Immutability: Ensures all transactions and state changes are recorded on the blockchain
- OpenCV: For image processing and product label pre-processing
- Tesseract: OCR engine for text extraction
- Solidity: Smart contract development language for the supply chain component
- Ethereum: Blockchain platform for deploying the smart contract
- Truffle: Development framework for Ethereum, providing tools for smart contract compilation, deployment, and testing
- Ganache: Personal blockchain for testing and development of smart contracts in a local environment
- Node.js: JavaScript runtime used for managing backend processes and running blockchain interaction scripts
- Python: Main language for the backend and data processing
- JSON: For storing ingredient data and compliance results
- Regex: For parsing and extracting ingredient information
- Install Python 3.8 or higher: Python Downloads
- Install Tesseract OCR:
- Windows: Download and install Tesseract for Windows
- macOS/Linux: Install via Homebrew or package manager
Configure Tesseract path:
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe' # Update with your path- Install npm and parcel (globally)
git clone <your-repo-url>
cd <your-repo-name>pip install -r requirements.txtNote: If there is no
requirements.txtfile yet, you can manually install required packages like OpenCV and pytesseract.
- Install Ganache and create a workspace.
- Install Truffle npm package globally by running
npm install -g truffle. - In the
truffle-config.jsfile update thefrom:address to an address from your Ganache workspace. - Run
truffle migrate --resetfrom the command line to deploy the smart contract to the blockchain. - Download Metamask Chrome extension for the browser to help interaction between the application and the blockchain.
- Navigate to the 'client' director:
cd client - Start the Parcel development server
npm run start
Use the smart contract functions to add raw material suppliers, manufacturers, distributors, and retailers and other supply chain actions. Track the state of cold drinks as they move through the supply chain.
- Place your image file (e.g.,
correct2.jpg) in the same directory as the script - Run the main script:
python your_script_name.py- The extracted ingredients and their compliance status will be saved in
ingredients.json
Contributions are welcome! Feel free to fork the repository, create a branch, and submit a pull request with your improvements or bug fixes.
This project is licensed under the MIT License.