  We introduce semi-perfect obstruction theory of a Deligne-Mumford stack $X$
consisting of local perfect obstruction theories with weak comparisons on
overlaps. We show that semi-perfect obstruction theory shares similar
properties with perfect obstruction theory. We use semi-perfect obstruction
theory to construct virtual cycles of moduli of derived objects on Calabi-Yau
threefolds.
  In the revision, we assume the existence of obstruction sheaf and put the
(coarse moduli of the) intrinsic normal cone inside the obstruction sheaf. This
avoids the issue of descent of bundle stacks of the local obstruction
complexes.
