Skip to content

Commit

Permalink
[wip] pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
xzyaoi committed Jan 24, 2019
1 parent f006b1c commit 059bd35
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 6 deletions.
1 change: 1 addition & 0 deletions cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func main() {
cvpm := cli.NewApp()
cvpm.Name = "CVPM"
cvpm.Usage = "Computer Vision Package Manager"
cvpm.Version = "0.0.3@alpha"
cvpm.Commands = []cli.Command{
{
Name: "login",
Expand Down
5 changes: 2 additions & 3 deletions cli/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package main

import (
"fmt"
"io/ioutil"
"log"
"os"
Expand Down Expand Up @@ -107,7 +106,7 @@ func runRepo(Vendor string, Name string, Solver string, Port string) {
}

// Clone a repo from @params remoteURL to @params targetFolder by Git Protocol.
// Used for installing and initialize a repo
// Used for installing and initializing a repo
func CloneFromGit(remoteURL string, targetFolder string) {
color.Cyan("Cloning " + remoteURL + " into " + targetFolder)
_, err := git.PlainClone(targetFolder, false, &git.CloneOptions{
Expand All @@ -116,7 +115,7 @@ func CloneFromGit(remoteURL string, targetFolder string) {
})
if err != nil {
raven.CaptureErrorAndWait(err, nil)
fmt.Println(err)
log.Fatal(err)
}
}

Expand Down
26 changes: 23 additions & 3 deletions cvpm/interface.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,36 @@
'''
@Author: Xiaozhe Yao
Interface is the definition of data structure between two solvers.
'''
class BaseInterface(object):
def __init__(self, name):
self.data = {}
self.name = name
self._data = {}
@property
def data(self):
return self._data

class ObjectDetectionInterface(BaseInterface):
# Image -> Coordinates
pass
# Data: {'x_start':Integer, 'x_stop':Integer, 'y_start':Integer, 'y_stop':Integer}
def __init__(self,name):
super().__init__(name)
self.data['data'] = []
def validate(self):
pass
def addObjectCoordinates(self, x_start, x_stop, y_start, y_stop, name):
self.data['data'].append({
"x_start": x_start,
"x_stop": x_stop,
"y_start": y_start,
"y_stop": y_stop,
"name": name
})

class ImageSegmentationInterface(BaseInterface):
# Image -> Pixel Map
pass

class ImagePreprocessingInterface(BaseInterface):
class ImageProcessingInterface(BaseInterface):
# Image -> Image
pass
Empty file added cvpm/pipeline.py
Empty file.
Binary file added cvpm/tests/assets/lenna.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions cvpm/tests/interface.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import unittest

import numpy as np
import PIL.Image

from cvpm.interface import ImageProcessingInterface
from cvpm.interface import ObjectDetectionInterface

def load_image_file(file, mode='RGB'):
im = PIL.Image.open(file)
if mode:
im = im.convert(mode)
return np.array(im)

class InterfaceTester(unittest.TestCase):
def test_detect_interface(self):
image_np = load_image_file('cvpm/tests/assets/lenna.jpg')
x_start, x_stop, y_start, y_stop = 12,13,14,15
postDetectionInterface = ObjectDetectionInterface('post_detection')
postDetectionInterface.addObjectCoordinates(x_start, x_stop, y_start, y_stop, 'face')
print(postDetectionInterface.data)

if __name__ == "__main__":
unittest.main()
File renamed without changes.

0 comments on commit 059bd35

Please sign in to comment.