Giter Club home page Giter Club logo

design-patterns-hw's Introduction

DP Implementation tracker

Pattern Implemented? Purpose

1

Singleton

YES

Only 1 admin

2

Factory

YES

Detected objects by the camera

3

Prototype

YES

Implementation of different detection algorithms

4

Object Pool

YES

A Pool of Available Cameras

5

Builder

YES

Not related to project

6

Abstract Factory

YES

GUI for QT and GTK

7

Iterator

YES

Iterator for detected objects

8

Observer

YES

Event logging

9

Memento

NO

-

10

Mediator*

NO

-

11

Decorator^

YES

Coffee ordering feature without leaving the station

[*] Chain of Responsibility - Command - Visitor - Mediator

[^] Adapter - Decorator - Component

Tasarım Örüntüleri ve kullanım açıklamaları

Bu projede bir güvenlik sistemi ROS kullanarak geliştirmeye çalıstım. Sistemde bir Publisher ve bir Subscriber var. Publisher kameradan görüntü alıp üzerinde nesne tespiti yapacak, görüntü ve tespit sonucu ayrı 'topic' olarak yayınlayacak. Subscriber o mesajları alıp, bir yöneticiyi gösterecek, yönetici şüpheli bir nesne görürse onu işaretleyebilir.

Proje tam olmadığı için her şey çalışmıyor (ör: GUI) ama kullandığım Örüntülerin demosu yapabilmek için yeterli kısmı bitirdim. Örüntüler ağşada anlatığım gibi kullandım:

publisher.py

publisher’de 4 örüntü ekledim:

from object_pool import object_pool
from prototype import prototype
from iterator import iterator
from builder import builder

object_pool

onun yardımıyla bizim Publisher Node sadece musait kameraları bağlayabilir.

prototype

Nesne tespit etmek için farkla algoritmalar var (YOLO, SSD, RCNN …​), her algoritma için bir Prototype Detector var, ve kullanıcı onlardan bir ya da daha fazla seçebilir.

iterator

Resimdeki Nesneleri tespit ettikten sonra, onları kolay incelemek ve işleme için bir Iterator yazdım.

builder

builder kalıbı projeye hiç bir şekikde entegre edemedim, sadece örnek kodu ekledim.

subscriber.py

subscriber’de 5 örüntü ekledim

from singleton import singleton
from factory import factory
from abstract_factory import abstract_factory
from observer import
from decorator_ import decorator as dec

singleton

Kontrol paneli için tek bir yönetici kullanabilir, onun için Singleton örüntüyü kullandım.

factory

Her tespit ettiğimiz bir nesne için ayrı bir 'Instance' oluşturabilmek için kullandım.

abstract_factory

Farklı sistemler için GUI yapabilmek için, bu örüntü kullanılabilir, mesala hem GNOME (GTK) hem de KDE (QT) destekleyebilmek için.

observer

Observer 2 şekilde kullandım: 1- ROS kendi Subscriber kullanarak 2 callback fonksyonu var. 2- bazı önemli olayları kaydedebilmek için, Observer örüntü yardımıyla bir 'Event Logger' yaptım.

decorator

Yönetici/ Güvenlik Üyesi onun paneli bırakmadan istediği Kahveyi sipariş verebilir.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.