Skip to content

Commit

Permalink
add some go doc and online documents
Browse files Browse the repository at this point in the history
  • Loading branch information
xzyaoi committed Oct 29, 2018
1 parent 1872bf0 commit fd3f95e
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 3 deletions.
9 changes: 9 additions & 0 deletions cli/config.go
@@ -1,3 +1,12 @@
/*
This file handles config related tasks, include:
readConfig()
writeConfig()
validateConfig()
getDefaultConfig()
The config file is located at the home dir of current user, under ~/cvpm/config.toml
*/
package main

import (
Expand Down
16 changes: 15 additions & 1 deletion cli/daemon.go
@@ -1,22 +1,30 @@
/*
This file handles daemon and services related tasks.
By using cvpm daemon install, it will install a system service under current user.
You can uninstall that service by using cvpm daemon uninstall
*/
package main

import (
"github.com/fatih/color"
"github.com/gin-gonic/gin"
"net/http"
)

// Default Running Port
const DaemonPort = "10590"

// Definition of Running Repos
var RunningRepos []Repository

// Struct of a Request to Run Repo
type RunRepoRequest struct {
Name string `json:name`
Vendor string `json:vendor`
Solver string `json:solver`
Port string `json:port`
}

// Handle Post Request -> Run a Repo
func PostRepoHandler(c *gin.Context) {
var runRepoRequest RunRepoRequest
c.BindJSON(&runRepoRequest)
Expand All @@ -26,10 +34,16 @@ func PostRepoHandler(c *gin.Context) {
})
}

// Handle Get Request -> Get Running Repo
func GetReposHandler(c *gin.Context) {
c.JSON(http.StatusOK, RunningRepos)
}

/* Run the Server and Do Mount Endpoint
/status -> Get to fetch System Status
/repo -> Post to Run a Repo
/repos -> Get to fetch Running Repos
*/
func runServer(port string) {
color.Red("Initiating")
r := gin.Default()
Expand Down
12 changes: 12 additions & 0 deletions cli/handler.go
@@ -1,3 +1,11 @@
/*
This file defines the handlers for different command.
Login
Install
List
Repo
and etc.
*/
package main

import (
Expand All @@ -17,6 +25,7 @@ import (
"syscall"
)

// Handle User Login
func LoginHandler(c *cli.Context) User {
reader := bufio.NewReader(os.Stdin)
fmt.Printf("Username: ")
Expand All @@ -30,6 +39,7 @@ func LoginHandler(c *cli.Context) User {
return currentUser
}

// Handle installation
func InstallHandler(c *cli.Context) {
config := readConfig()
localFolder := config.Local.LocalFolder
Expand Down Expand Up @@ -58,6 +68,7 @@ func InstallHandler(c *cli.Context) {
writeConfig(config)
}

// Handle List
func listRepos(c *cli.Context) {
config := readConfig()
table := tablewriter.NewWriter(os.Stdout)
Expand All @@ -68,6 +79,7 @@ func listRepos(c *cli.Context) {
table.Render()
}

// Handle Daemon Related
func DaemonHandler(c *cli.Context) {
params := c.Args().Get(0)
switch params {
Expand Down
8 changes: 8 additions & 0 deletions cli/main.go
@@ -1,3 +1,11 @@
/*
Package CVPM (main) implements the CLI for CVPM.
To get started, use:
cvpm help
to get a detailed explanation.
*/
package main

import (
Expand Down
2 changes: 1 addition & 1 deletion docs/en-US/guide/credits.md
Expand Up @@ -8,7 +8,7 @@
We would like to extend our sincere appreciate for the following organizations and individuals for their kind help during the development and production of CVPM.

* [Shenzhen University](https://www.szu.edu.cn) for providing lots of general help.
* [Oregon State University Open Source Lab](https://www.google.com.hk/search?q=osuosl&oq=osusl&aqs=chrome.1.69i57j0l5.2563j1j4&sourceid=chrome&ie=UTF-8) for hosting open source and public models.
* [Oregon State University Open Source Lab](https://osuosl.org/) for hosting open source and public models.
* [Netlify](https://www.netlify.com/) for providing CI/CD for documentation.
* [Clarifai](https://clarifai.com/) for providing image recognition models.
* [Amazon Web Services](https://aws.amazon.com) for providing general web services.
Expand Down
84 changes: 83 additions & 1 deletion docs/en-US/guide/write-package.md
Expand Up @@ -52,15 +52,97 @@ This chapter and its related function may have broken changes recently. ([#64](h

### cvpm.toml

cvpm.toml is the entry file that tells the cvpm system which solver it should looking for. It uses [toml](https://github.com/toml-lang/toml) syntax and should looks like the following format:

``` toml
[package]
name="Your_Package_Name"

[[solvers]]
name="Your_Solver_1_Name"
class="path/to_your_folder/Solver_Class_Name"

[[solvers]]
name="Your_Solver_2_Name"
class="path/to_your_folder/Solver_Class_Name"

[[solvers]]
name="Your_Solver_3_Name"
class="path/to_your_folder/Solver_Class_Name"
```

For example, the Face Utility that we provided as one of our official models have the [cvpm.toml](https://github.com/cvmodel/Face_Utility/blob/master/cvpm.toml) file as following:

``` toml
[package]
name="Face_utility"

[[solvers]]
name="Face_Detection"
class="face_utility/solver/FaceDetectionSolver"

[[solvers]]
name="Face_Landmark"
class="face_utility/solver/FaceLandmarkSolver"

[[solvers]]
name="Face_Encoding"
class="face_utility/solver/FaceEncodingSolver"
```

Make sure this file is located at the root path of your project.

### Pre-trained models

In most occasions, your algorithms (or neural networks etc.) should be uploaded along with some pre-trained models. We encourage you to upload it with our CLI (Not Done yet. [#72](https://github.com/unarxiv/CVPM/issues/72)), but it is also allowed if you upload it another downloadable services.

You need to define your pre-trained models in ```pretrained/pretrained.toml``` file as following using [toml syntax](https://github.com/toml-lang/toml):

``` toml
[[models]]
name = "model_file_name"
url = "https://www.example.com/your_model_file.zip" # Remote File

[[models]]
name = "model_file_name"
url = "pretrained/name_of_your_modelfile" # Local File
```

For example, the Face Utility that we provided as one of our official models have the [pretrained.toml](https://github.com/cvmodel/Face_Utility/blob/master/pretrained.toml) file as following:

``` toml
[[models]]
name = "dlib_face_recognition_resnet_model_v1"
url = "https://premium.file.cvtron.xyz/data/dlib_face_recognition_resnet_model_v1.dat"

[[models]]
name = "mmod_human_face_detector"
url = "https://premium.file.cvtron.xyz/data/mmod_human_face_detector.dat"

[[models]]
name = "shape_predictor_5_face_landmarks"
url = "https://premium.file.cvtron.xyz/data/shape_predictor_5_face_landmarks.dat"

[[models]]
name = "shape_predictor_68_face_landmarks"
url = "https://premium.file.cvtron.xyz/data/shape_predictor_68_face_landmarks.dat"
```

Make sure this file is located at the ```pretrained``` subfolder of your project.

### Pre/Post Install Scripts

::: tip It is an ongoing plan and have not been implemented yet. ([#49](https://github.com/unarxiv/CVPM/issues/49)) :::

## Publish to Model Hub



## Publish to GitHub

When publishing to GitHub, mention "CVPM Available" at the top of your README file, only if you want you model to be searchable by the Model Hub.

Your README file should be look like
Your README file should be look like the following:

```
## PROJECT NAME
Expand Down
4 changes: 4 additions & 0 deletions docs/zh-CN/guide/README.md
Expand Up @@ -21,6 +21,10 @@ CVPM is a package manager for computer vision. It helps you to download, install

Full documentation can be found [here](https://cvpm.autoai.org).

## News

* *[2018-10-29]* The development of CVPM is under heavy development and we have changed many api designs in the last 2 weeks. There might be some minor differences in the documentation because of that broken change. We **Strongly** recommend you to wait until the next official release (v0.1). It is supposed to be the first stable version, and there should not be any major api changes since that.

## Contributing

If you found a security bugs, please do not post it in issues or any other public forum. You can send me [email](mailto:xiaozhe.yaoi@qq.com) directly.
Expand Down

0 comments on commit fd3f95e

Please sign in to comment.