LinJinwei commited on
Commit
9143767
·
verified ·
1 Parent(s): 1736314

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +165 -0
README.md CHANGED
@@ -1,3 +1,168 @@
1
  ---
2
  license: lgpl
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: lgpl
3
  ---
4
+
5
+ # OneTo3D: One Image to Editable Dynamic 3D Model and Video Generation
6
+
7
+ Project Code For Paper: OneTo3D: One Image to Editable Dynamic 3D Model and Video Generation
8
+
9
+
10
+ [Project Page](https://lin-jinwei.github.io/projects/OneTo3D/OneTo3D.html)
11
+
12
+ ---
13
+
14
+ ### OnTo3D Logo
15
+ ![image](https://github.com/lin-jinwei/OneTo3D/blob/main/data/logo/OneTo3D.png)
16
+
17
+ ---
18
+ ### Display of Continuous Model Action and Video Generation
19
+
20
+ #### Input0: 2D Image of the object
21
+
22
+ <img src="https://github.com/lin-jinwei/OneTo3D/blob/main/data/people.png" width = 360>
23
+
24
+ #### Input1: Text Command
25
+ ```python
26
+ command = 'Big: The object raises his head 30 degrees, bowed his head 20 degrees, and shakes his head 60 degrees, looks left 22.33 degrees, looks right 22.33 degrees, walked 2 steps tiems and ran 3 steps tiems seconds, raised his left hand 20 degrees, raised his right hand 20 degrees, put down his left hand 30 degrees, put down his right hand 30 degrees, waves his left hand 60 degrees, waves his right hand 60 degrees, lift his left leg 60 degrees, lift his right leg 60 degrees, puts down his left leg 60 degrees, puts down his right leg 60 degrees, puts down his left leg, lifts his left leg, raises his left forearm 30 degrees, raises his right forearm 30 degrees, puts down his left forearm 30 degrees, puts down his right forearm 30 degrees, wave his left forearm 45 degrees, wave his right forearm 45 degrees, puts down his left calf 20 degrees, puts down his right calf 20 degrees, lifts his left calf 20 degrees, lifts his right calf 20 degrees, puts down his left calf, puts down his right calf, lifts his left calf, lifts his right calf, to the car'
27
+ ```
28
+ command = 'Big: The object raises his head 30 degrees, bowed his head 20 degrees, and shakes his head 60 degrees, looks left 22.33 degrees, looks right 22.33 degrees, walked 2 steps tiems and ran 3 steps tiems seconds, raised his left hand 20 degrees, raised his right hand 20 degrees, put down his left hand 30 degrees, put down his right hand 30 degrees, waves his left hand 60 degrees, waves his right hand 60 degrees, lift his left leg 60 degrees, lift his right leg 60 degrees, puts down his left leg 60 degrees, puts down his right leg 60 degrees, puts down his left leg, lifts his left leg, raises his left forearm 30 degrees, raises his right forearm 30 degrees, puts down his left forearm 30 degrees, puts down his right forearm 30 degrees, wave his left forearm 45 degrees, wave his right forearm 45 degrees, puts down his left calf 20 degrees, puts down his right calf 20 degrees, lifts his left calf 20 degrees, lifts his right calf 20 degrees, puts down his left calf, puts down his right calf, lifts his left calf, lifts his right calf, to the car'
29
+
30
+ #### Output1: Editable 3D Model and Video
31
+ ![image](https://github.com/lin-jinwei/OneTo3D/blob/main/output3D/gifs/0001-0396.gif)
32
+
33
+ The speed of object actions and 3D video rendering is editable.
34
+
35
+ #### Input2: Text Command
36
+ ```python
37
+ command = 'The object walked 2 steps or times, then turns left 0 degrees, raised his left hand, raises his right hand 30 degrees, moves 3 miles in -y direction, raises his head 30 degrees, bowed his head 20 degrees, puts down his left hand, puts down his right hand 10 degrees, and ran 3 steps times seconds, following moves 2 miles in y direction, puts down his right hand 88 degrees, puts down his left hand 88 degrees, then turns left, moves 3 miles in x direction, looks left, looks right, raising his left hand 60 degrees, raised his right hand 20 degrees, looks right 22.33 degrees, walked 2 steps or times, moves 3 miles in -y direction, and ran 3 steps times seconds, puts down his left hand 60 degrees, puts down his right hand 10 degrees, following moves 2 miles in y direction. Then the object lifts his left leg, puts down his left leg, lifts his right leg, puts down his right leg, puting down his right leg, putting down his left leg 60 degrees, lifts his left leg 10 degrees. Then The object lifts his left leg 0 degrees, lifts his left leg, puts down his left calf 60 degrees, lifts his left calf 60 degrees, puts down his right calf 60 degrees, lifts his right calf 60 degrees, puts down his left leg, moves 3 miles in -x direction, run in 5 miles, raised his left hand 60 degrees, waves his left hand, waves his left forearm, going.'
38
+ ```
39
+ command = 'The object walked 2 steps or times, then turns left 0 degrees, raised his left hand, raises his right hand 30 degrees, moves 3 miles in -y direction, raises his head 30 degrees, bowed his head 20 degrees, puts down his left hand, puts down his right hand 10 degrees, and ran 3 steps times seconds, following moves 2 miles in y direction, puts down his right hand 88 degrees, puts down his left hand 88 degrees, then turns left, moves 3 miles in x direction, looks left, looks right, raising his left hand 60 degrees, raised his right hand 20 degrees, looks right 22.33 degrees, walked 2 steps or times, moves 3 miles in -y direction, and ran 3 steps times seconds, puts down his left hand 60 degrees, puts down his right hand 10 degrees, following moves 2 miles in y direction. Then the object lifts his left leg, puts down his left leg, lifts his right leg, puts down his right leg, puting down his right leg, putting down his left leg 60 degrees, lifts his left leg 10 degrees. Then The object lifts his left leg 0 degrees, lifts his left leg, puts down his left calf 60 degrees, lifts his left calf 60 degrees, puts down his right calf 60 degrees, lifts his right calf 60 degrees, puts down his left leg, moves 3 miles in -x direction, run in 5 miles, raised his left hand 60 degrees, waves his left hand, waves his left forearm, going.'
40
+
41
+ #### Output2: Editable 3D Model and Video
42
+
43
+ ![image](https://github.com/lin-jinwei/OneTo3D/blob/main/output3D/gifs/v25.gif)
44
+
45
+ ---
46
+ ### Installation
47
+
48
+ 1. For the part of generating the initial 3D model, our project selects the [DreamGaussian](https://github.com/dreamgaussian/dreamgaussian) as the basic generation model. You can select other suitable you like to generate the initial 3D model.
49
+
50
+ 2. Create a Conda enviroment for OneTo3D:
51
+
52
+ ```cmd
53
+ conda create -n OneTo3D python=3.10.11
54
+ ```
55
+
56
+ You can test other versions of python enviroments.
57
+
58
+ 3. Download the whole directoies of [diff-gaussian-rasterization](https://github.com/graphdeco-inria/diff-gaussian-rasterization) and [simple-knn](https://github.com/graphdeco-inria/gaussian-splatting/blob/main/submodules/simple-knn). Build and intall these two dependencies here or later.
59
+
60
+ 4. Install the same enviroment of [DreamGaussian](https://github.com/dreamgaussian/dreamgaussian).
61
+
62
+ 5. Run and Install other required python libraries.
63
+
64
+ ---
65
+
66
+ ### Usage and Test
67
+
68
+ #### Preparing the Data
69
+
70
+ 1. Put the image of analyzed object in the directory **./data** of **OneTo3D**. The default format of the image is .png.
71
+ (Note: In the version of OneTo3D, the suitable type of the processed object is human form.)
72
+
73
+ 3. Run the following code to remove the background (from DreamGaussian). If the Background is not removed clear, removing it manually.
74
+
75
+ ```cmd
76
+ python dg1.py --config configs/image-2.yaml input=data/[input object image path] save_path=data/[output object model path]
77
+ ```
78
+ example:
79
+ ```cmd
80
+ python dg1.py --config configs/image-2.yaml input=data/people_rgba.png save_path=data/people_rgba/people_rgba.png
81
+ ```
82
+
83
+ ---
84
+
85
+ #### Run and Generating
86
+ 1. Generate the initial 3D model:
87
+
88
+ ```cmd
89
+ python process.py data/[the name (including the extension) of the processed image]
90
+ ```
91
+ example:
92
+ ```cmd
93
+ python process.py data/people.png
94
+ ```
95
+
96
+ 2. Make the basic optimization for the initial 3D model:
97
+ ```cmd
98
+ python dg2.py --config configs/image-2.yaml input=data/[input object image path] save_path=data/[output object model path]
99
+ ```
100
+ example:
101
+ ```cmd
102
+ python dg2.py --config configs/image-2.yaml input=data/people_rgba.png save_path=data/people_rgba/people_rgba.png
103
+ ```
104
+
105
+ 3. Run the **get2DBones.py** to analyze and get the keypoints :
106
+ ```cmd
107
+ python [OneTo3D home path]/get2DBones.py --objName people
108
+ ```
109
+ example:
110
+ ```cmd
111
+ & D:/Anaconda/envs/OneTo3D/python.exe e:/OneTo3D/get2DBones.py --objName people
112
+ ```
113
+ The **--objName** parameter represents the name of the image of analyzed object.
114
+
115
+ 4. Run the **animation.py** to get the commands list of the input text:
116
+ ```cmd
117
+ python [OneTo3D Home]/animation.py --command [text command]
118
+ ```
119
+ example:
120
+ ```cmd
121
+ & D:/Anaconda/envs/OneTo3D/python.exe e:/OneTo3D/animation.py --command 'The object moves 2 miles in x direction.'
122
+ ```
123
+
124
+ 5. Using the **Blender** python environment to run the **bpyBones.py**, to automatically generate self-adaption armature of the object, armature analyzing and binding, 3D cameras and lights adjustment of the secene, and generating the **re-editable** blender files and 3D video with '.mkv' format.
125
+
126
+ ```cmd
127
+ [[Blender Installed Path]/blender.exe] -P [OneTo3D Home]/bpyBones.py
128
+ ```
129
+ example:
130
+ ```cmd
131
+ D:/Blender/blender.exe -P E:\OneTo3D\bpyBones.py
132
+ ```
133
+ 6. The generated 3D model and video files are saved in './output3D'.
134
+
135
+ ---
136
+
137
+ #### Optional Operations
138
+ 1. Change the generated 3D video to '.gif' dynamic image:
139
+
140
+ a. Install moviepy first.
141
+
142
+ ```cmd
143
+ pip install moviepy
144
+ ```
145
+
146
+ b. Run to get the gif image.
147
+
148
+ ```cmd
149
+ python [OneTo3D Home]/bpyBones.py --videoName [The video name in [[OneTo3D Home]/output3D./3Dvideo]]
150
+ ```
151
+ example:
152
+ ```cmd
153
+ & D:/Anaconda/envs/OneTo3D/python.exe E:\OneTo3D\vidoeToGif.py --videoName '0001-0396.mkv'
154
+ ```
155
+
156
+ 2. Configure and run the [OneTo3D Home]/drawKeyPoint.py to get the armature key points drawn image.
157
+
158
+ 3. Configure and run the [OneTo3D Home]/bpy6Views.py to get the six views projection image of the object.
159
+
160
+ ---
161
+
162
+ ### Paper Cite
163
+ Writing...
164
+
165
+
166
+
167
+
168
+